Convert a Torn Timestamp to YY/MM/DD hh:mm:ss
-
Thread created on 00:14:38 - 03/02/22 (2 years ago)|Last replied 10:47:33 - 13/02/22 (2 years ago)I would like help creating a formula to convert a torn timestamp such as "1643806272" into a human readable date (ie YY/MM/DD hh:mm:ss).
Thanks
ANSWER (edit):
Torn/Unix Timestamps are the number of seconds since Jan 1st 1970.Last edited by HOU5E on 22:33:28 - 13/02/22 -
-
Posted on 01:31:21 - 03/02/22 (2 years ago)Post link copied to clipboard Copy post linkI'm having trouble with this too. Is it Unix time? (According to wikipedia, Unix time is the number of seconds since 00:00:00 UTC, January 1, 1970).
-
-
Posted on 07:09:23 - 03/02/22 (2 years ago)Post link copied to clipboard Copy post linkIt's indeed Unix time. Converting it depends on your language used though.
Most languages allow you to from unix millis (hence the * 1000, as Torn is in seconds) to their date object:- Javascript: "new Date(unix * 1000);"
- Java Date (old Date object): "new Date(unix * 1000);"
- Java LocalDateTime (java 8+): check here
- for other languages I'll leave the research to you
Once you have that date object, you can then convert it to a readable format:- Javascript: you'll probably have to do this yourself (using "getFullYear()", "getMonth() + 1" (january = 0, it's weird, I know), etc...)
- Java Date (old Date object): "SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd HH:mm:ss"); String result = format.format(date);"
- Java LocalDateTime (java 8+): "DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yy/MM/dd HH:mm:ss"); String result = date.format(formatter)"
Last edited by DeKleineKobini on 07:09:31 - 03/02/22 -
-
Posted on 12:02:40 - 10/02/22 (2 years ago)Post link copied to clipboard Copy post linkVisual Basic is pretty easy
Function UnixToDate(ByVal UnixTime as Long) As Date
UnixToDate= DateAdd("s", UnixTime, DateSerial(1970, 1, 1))
End Function -
-
Posted on 04:57:36 - 11/02/22 (2 years ago)Post link copied to clipboard Copy post linkSo in simple terms Torn (Unix) timestamp is the number of seconds since Jan 1st 1970. Ok.
-
-
Posted on 22:46:56 - 12/02/22 (2 years ago)Post link copied to clipboard Copy post linkFor python
from time import strftime, gmtime
strftime('%Y-%m-%d %H:%M:%S', gmtime(1644019200))
'2022-02-05 00:00:00'..why would anyone but a total loser pay money to play a browser game???? -
-
Posted on 10:47:33 - 13/02/22 (2 years ago)Post link copied to clipboard Copy post linkFor php
$theTime = '1643806272';
echo(date("Y/M/D h:m:s",$theTime));
>> 2022/Feb/Wed 12:02:12
or...
$theTime = '1643806272';
echo(date("Y/M/d h:m:s",$theTime));
>> 2022/Feb/02 12:02:12 -