|
of_convertpbdatetimetofile
|
|
Full name
|
pfc_n_cst_filesrvaix.of_convertpbdatetimetofile
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_convertpbdatetimetofile(date,time,ref os_filedatetime)
|
Name
|
Datatype
|
ls_Date
|
string
|
ls_Time
|
string
|
lstr_LocalTime
|
os_filedatetime
|
lstr_SystemTime
|
os_systemtime
|
protected function integer of_convertpbdatetimetofile (date ad_filedate, time at_filetime, ref os_filedatetime astr_filetime);//////////////////////////////////////////////////////////////////////////////
// Protected Function: of_ConvertPBDatetimeToFile
// Arguments: ad_FileDate The file date in PowerBuilder Date format.
// at_FileTime The file time in PowerBuilder Time format.
// astr_FileTime The os_filedatetime structure to contain the system date/time for the file, passed by reference.
// Returns: Integer
// 1 if successful, -1 if an error occurrs.
// Description: Convert PowerBuilder Date and Time to the sytem file type.
//////////////////////////////////////////////////////////////////////////////
// Rev. History: Version
// 6.0 Initial version
// 6.0.01 Fix millisecond overflow. Change size of string to 3 digits from 6
//////////////////////////////////////////////////////////////////////////////
// Copyright © 1996-1999 Sybase, Inc. and its subsidiaries. All rights reserved. Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
string ls_Date, ls_Time
os_filedatetime lstr_LocalTime
os_systemtime lstr_SystemTime
ls_Date = String(ad_FileDate, "yyyy-mm-dd")
lstr_SystemTime.ui_wyear = Long(Left(ls_Date, 4))
lstr_SystemTime.ui_WMonth = Long(Mid(ls_Date, 6, 2))
lstr_SystemTime.ui_WDay = Long(Right(ls_Date, 2))
ls_Time = String(at_FileTime, "hh:mm:ss:fff")
lstr_SystemTime.ui_wHour = Long(Left(ls_Time, 2))
lstr_SystemTime.ui_wMinute = Long(Mid(ls_Time, 4, 2))
lstr_SystemTime.ui_wSecond = Long(Mid(ls_Time, 7, 2))
lstr_SystemTime.ui_wMilliseconds = Long(Right(ls_Time, 3))
If Not SystemTimeToFileTime(lstr_SystemTime, lstr_LocalTime) Then Return -1
If Not LocalFileTimeToFileTime(lstr_LocalTime, astr_FileTime) Then Return -1
Return 1
end function