Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting UNIX date in Word 1

Status
Not open for further replies.

JBU

Instructor
Nov 3, 2003
25
IN
Hi

I want to convert a unix date (e.g. 1084199760) into dd,mm,yyyy hh:mm:ss. How do I do this in Word VBA? There must be a simple way right?

Jens Busse
Workflow Consultant
CCI Europe A/S
 
I think the Unix time will be the number of seconds since 1970 but I could be wrong? so the DateAdd function is what you are looking for. eg dostime = DateAdd("s", unix_time, #1/1/1970#)


 
Something like this ?
MsgBox Format((1084199760 / 86400) + 25568, "dd/mm/yyyy hh:nn:ss")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thx nnett. That was exactly what I were looking for.

Jens Busse
Workflow Consultant
CCI Europe A/S
 
Oops, typo:
MsgBox Format((unix_timestamp / 86400) + 25569, "dd/mm/yyyy hh:nn:ss")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top