Converting a UNIX Timestamp to Formatted Date String
Try gmdate like this:
Try gmdate like this:
Avoid the Date object creation w/ System.currentTimeMillis(). A divide by 1000 gets you to Unix epoch. As mentioned in a comment, you typically want a primitive long (lower-case-l long) not a boxed object long (capital-L Long) for the unixTime variable’s type.
Check the JavaScript Date documentation.
I would use time.time() to get a timestamp in seconds since the epoch. Output: For the standard CPython implementation on most platforms this will return a UTC value.