设为首页 加入收藏

TOP

pb9获取文件创建时间、最后修改时间及设置最后修改时间的方法(三)
2014-11-23 22:54:19 来源: 作者: 【 】 浏览:24
Tags:pb9 获取 文件 创建 时间 最后 修改 设置 方法
String(lstr_SystemTime.ui_wSecond) + ":" + &
String(lstr_SystemTime.ui_wMilliseconds)))
Return 1
end function

private function integer of_convertpbdatetimetofile (datetime adt, ref os_filedatetime astr_filetime);//转换文件系统时间为PB时间
os_filedatetime lstr_LocalTime
os_systemtime lstr_SystemTime

lstr_SystemTime.ui_wyear = year(date(adt))
lstr_SystemTime.ui_WMonth = Month(date(adt))
lstr_SystemTime.ui_WDay = Day(date(adt))

lstr_SystemTime.ui_wHour = hour(time(adt))
lstr_SystemTime.ui_wMinute = Minute(time(adt))
lstr_SystemTime.ui_wSecond = Second(time(adt))
lstr_SystemTime.ui_wMilliseconds = Long(String(adt, "fff"))

If Not SystemTimeToFileTime(lstr_SystemTime, lstr_LocalTime) Then Return -1

If Not LocalFileTimeToFileTime(lstr_LocalTime, astr_FileTime) Then Return -1

Return 1
end function

on n_cst_filetime.create
call super::create
TriggerEvent( this, "constructor" )
end on

on n_cst_filetime.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

程序中这样调用即可:
[cpp]
n_cst_filetime ln
string ls_file = 'C:\Program Files\ Sybase\PowerBuilder 9.0\pb90.exe'
datetime ldt_create, ldt_lastwrite
ln.of_getcreatedatetime( ls_file, ldt_create)
ln.of_getlastwritedatetime( ls_file, ldt_lastwrite)
messagebox('提示', '文件【' + ls_file + '】~r~n~r~n创建时间: ' + string(ldt_create, 'yyyy年mm月dd日, hh:mm:ss.fff') +&
'~r~n修改日期: ' + string(ldt_lastwrite, 'yyyy年mm月dd日, hh:mm:ss.fff') )


摘自 yyoinge的专栏
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇SybaseIQ建立代理表 下一篇SybSQLException: The datastream..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: