Timestamp2Time & now2Timestamp

Share your advanced PureBasic knowledge/code with the community.
Pille
New User
New User
Posts: 7
Joined: Thu Jul 03, 2003 11:29 pm

Timestamp2Time & now2Timestamp

Post by Pille »

Code updated for 5.20+

Code: Select all

; 
; by Pille, 15.07.2003 
; 

Procedure.s Timestamp2Time(stamp.l) 
  ;Time = Timestamp2Time(1234567890) 

    tStart.l = Date(1970,01,01,00,00,00) 
    ProcedureReturn FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", tStart+stamp) 
EndProcedure 

Procedure.l now2Timestamp() 
  ;Timestamp.l = now2Timestamp() 
    
    tStart.l = Date(1970,01,01,00,00,00) 
    ProcedureReturn tStart + Date() 
EndProcedure 


Debug Timestamp2Time(0) 
Debug Timestamp2Time(1234567890) 

Debug now2Timestamp() 
Debug Timestamp2Time(now2Timestamp())
@Fred: You should fix the AddDate() Function