Posted by: David | September 16, 2010

VBS Date functions

After a recent bit of programming I had to convert from VBS dates to dates in the format of UNIX Time stamps, I ended up writing the following two functions:
Function date2timestamp(vbdate)
'call with varunixtimestamp = date2timestamp(varvbdate)
date2timestamp = DateDiff("s", "01/01/1970 00:00:00", vbdate)
End function

Function timestamp2date(unixtimestamp)
'call with varvbdate = timestamp(unixtimestamp)
timestamp2date = DateAdd("s", unixtimestamp, "01/01/1970 00:00:00")
End function


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: