of_convertpbdatetimetofile


pfcapsrv.pbl   >   pfc_n_cst_filesrvunicode   >   of_convertpbdatetimetofile   

Full name pfc_n_cst_filesrvunicode.of_convertpbdatetimetofile
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_convertpbdatetimetofile(date,time,ref os_filedatetime)

Name Datatype
No Data

Name Datatype
ls_Time String
lstr_LocalTime os_filedatetime
lstr_SystemTime os_systemtime
lui_test unsignedinteger
lui_year unsignedinteger

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
//						5.0   Initial version
//						5.0.03	Fix problem with century not being on the year passed in
//						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_Time
unsignedinteger	lui_year, lui_test
os_filedatetime	lstr_LocalTime
os_systemtime	lstr_SystemTime

// fix problem when year without century passed in
lui_year = integer(string(ad_FileDate,'yyyy'))
lui_test = year(ad_filedate)
if lui_year < 50 then
	lui_year = lui_year + 2000
elseif lui_year < 100 then
	lui_year = lui_year + 1900
end if 

// make sure year with century is passed in
lstr_SystemTime.ui_wyear = lui_year
lstr_SystemTime.ui_WMonth = month(ad_FileDate)
lstr_SystemTime.ui_WDay = day(ad_FileDate)

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

     
Name Owner
pfc_n_cst_filesrvunicode.of_setlastwritedatetime pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.of_setcreationdatetime pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.of_setlastaccessdate pfc_n_cst_filesrvunicode

     
Name Owner
systemfunctions.day systemfunctions
systemfunctions.integer systemfunctions
systemfunctions.left systemfunctions
systemfunctions.long systemfunctions
systemfunctions.mid systemfunctions
systemfunctions.month systemfunctions
systemfunctions.right systemfunctions
systemfunctions.string systemfunctions
systemfunctions.year systemfunctions
pfc_n_cst_filesrvunicode.SystemTimeToFileTime pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.LocalFileTimeToFileTime pfc_n_cst_filesrvunicode

     
Full name
pfc_n_cst_filesrvunicode.os_systemtime

     
Name Scope
No Data