System Administration Scripting

2007年3月26日星期一

论坛注册时间转换

'注册时间表是1970年1月1日0零时零分零秒算起的秒数,将其转换成具体的实际时间。
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("E:\RegDate.xls")

objExcel.DisplayAlerts = False

intRow = 2

Do Until objExcel.Cells(intRow,1).Value = ""

dt = DateAdd("s", objExcel.Cells(intRow, 5).Value, "01/01/1970 00:00:00")
fdt = FormatDateTime(DateValue(dt))
ftm = FormatDateTime(TimeValue(dt))
if Len(fdt) < 10 then
fdt = space(10 - Len(fdt)) & fdt
end if
if Len(ftm) = 10 then
ftm = " " & ftm
end if
ThisTime = fdt & " " & ftm
go = Year(ThisTime) & "-" & Month(ThisTime) & "-" & Day(ThisTime)
objExcel.Cells(intRow, 5).Value = CStr(go)

intRow = intRow + 1

Loop

objWorkbook.SaveAs "E:\MbrRegDate.xls"

objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google


0 评论:

©2007 LastUpdated : 09/01/2024 10:03:43