[Gambas-user] Unix time format
T Lee Davidson
t.lee.davidson at gmail.com
Thu Aug 4 21:09:38 CEST 2022
On 8/4/22 14:34, Martin wrote:
> I want to compare the timestamp (mtime) from files provided by the stat command, as you know is something like "1659639479"
> I made a function (please see below)
> Maybe gambas include some native method or function?
> Static Public Function TimeUnix(datTime As Date) As Integer
> Return DateDiff(Date(1970, 1, 1, 0, 0, 0), datTime, gb.Second)
When I use `stat` on a file, I get a format different than what you stated; eg. "2022-01-01 13:30:47.592253508 -0500"
But, no matter, perhaps what you are looking for is the FromUnixTime method of Date (gb.util).
More information about the User