' Convert standard Time to UNIX timestamp Function tounixtime (strtime, Inttimezone) If IsEmpty (strtime) or not IsDate (strtime) Then Strtime = N ow If IsEmpty (inttimezone) or not IsNumeric (inttimezone) Then Inttimezone = 0 Tounixtime = DateAdd ("h",-inttimezon E,strtime) Tounixtime = DateDiff ("s", "1970-01-01 00:00:00", tounixtime) End Function
' Convert UNIX timestamp to standard Time Function fromunixtime (Inttime, Inttimezone) If IsEmpty (inttime) or not IsNumeric (inttime) Then Fromunixtime = Now () Exit Function End If If IsEmpty (inttime) or not IsNumeric (Inttimezone) the n Inttimezone = 0 fromunixtime = DATEADD ("s", Inttime, "1970-01-01 00:00:00") Fromunixtime = DateAdd ("h", Inttimez One, fromunixtime) End Function
' Call method: ' Example: Tounixtime ("2009-12-05 12:52:25", +8), the return value is 1259988745 ' response. Write tounixtime ("2009-12-05 12:52:25", +8) ' Example: Fromunixtime ("1259988745", +8), return value 2009-12-05 12:52:25 ' response. Write fromunixtime ("1259988745", +8)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.