WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Convert Unix Time

 Keywords: unix GMT format time convert 

Question:

I am using an application that stores dates and times in Unix format that I do not really understand.
1195491966 = 11/19/2007 12:06:06 
1195480951 = 11/19/2007 09:02:31 
How I do I make the conversion to TimeYmdHms()

Answer:

It is the number of seconds since the start of 1970 GMT time.
TimeA=1195491966
TimeB=1195480951

; get beginning of 1970
d1970="1970:01:01:00:00:00"
;-5 time correction - Unix info seem like in Greenich time, you seem like on EST
d1970M5=TimeSubtract(D1970,"0000:00:00:05:00:00")

;add "unix" TimeA number of seconds
result=TimeAdd(D1970M5,strcat("0000:00:00:00:00:",TimeA) )
Message(TimeA,result)


;add "unix" TimeBnumber of seconds
result=TimeAdd(D1970M5,strcat("0000:00:00:00:00:",TimeB) )
Message(TimeB,result)

Article ID:   W17472
File Created: 2008:04:10:15:11:18
Last Updated: 2008:04:10:15:11:18