I have timestamps stored in time since epoch (ms) and I would like to query and display results using a date formatted like 'yyyy-mm-dd'.
cast(from_unixtime(unixtime) as date)
See https://prestodb.io/docs/current/functions/datetime.html for more datetime functions.
as you mentioned epoc(ms)
division by 1000 would convert it to seconds.
date(from_unixtime(min(ts)/1000))
This helped me my epoch time is saved as BigInt and stored to be accurate to milliseconds.
Use following to get the answer in YYYY-MM-DD format
format_datetime(from_unixtime(unixtime), 'Y-MM-dd')
Example:
format_datetime(from_unixtime(1664582792), 'Y-MM-dd')
Output --> 2022-10-01
Using cast as date as follows
cast(from_unixtime(1664582792) as date)
will give output as
2022-10-01 00:00:00.000
Related
2021-01-14T17:00:23.87Z
I am trying to convert the info above to date and time and keep milliseconds. Does anyone have a formula for this?
I give up trying to find a perfect match on this site:
=--SUBSTITUTE(LEFT(A1,LEN(A1)-1),"T"," ")
Then format the cell: yyyy-mm-dd hh:mm:ss.00
i have the test data exported from Dynamo DB in the following format. (11/26/2019 18:59:13.523)
So it writes the date and time along with its milliseconds. i need to change the time zone to 12 hours rather 24 hour clock. Can someone guide me how to do that.
TEXT() on that string, and
format it as 'mm/dd/yyy hh:mm:ss.000 AM/PM' using Ctrl+1, Custom
Is there any way in Excel to convert the timestamp in the format
{"_seconds":1570448585,"_nanoseconds":834000000}
to readable format (Human-friendly)?
1-Oct-2018 12:00 PM
The seconds look like a UNIX timestamp.
UNIX time started counting seconds 1970.
To convert it you need to start with the date 1970-01-01 and add the days as a float.
=DATE(1970,1,1) + A1/60/60/24
I found the solution - There is a feature called "Text to column"
How can i convert the microsecond ****62302456149**** to
hour minute second
format in Excel.please give me solution.Thanks in advance.
Find below required solution (image link), where hours, minutes and secs are showing separate cells which you can combine to get required format.
I have collected some details from sql and it shows a birthdates as following (each line represents a different birthdate):
-294022800
649119600
-138675600
49158000
32396400
631152000
-2147483648
731894400
-408067200
522025200
I was trying to change them in excel using this formula:
=DATE(INT(A1/10000),INT((A1-10000*INT(A1/10000))/100),A1-(100*INT(A1/100)))
But it didnt work well, it must be in different format. Do you know what sort of format it is and how to convert it to date in excel? why some of numbers are negatives?
Can this be the EPOCH format? how to change it to normal human date in excel?
My guess would be that they are unix timestamps http://en.wikipedia.org/wiki/Unix_time
In excel, you can use something like:
=(((A1/60)/60)/24)+DATE(1970,1,1)
Although, you will have to watch out for the fact that your datetimes seem to include daylight savings offsets. (Some of them are multiples of a day (24*60*60), but others are an hour out). I'm not sure why you have a non-hour multiple in there (-2147483648), possibly some quirk of the original system.
Source: http://spreadsheetpage.com/index.php/tip/converting_unix_timestamps/
Unix timestamps can be converted with this formula
=A1/86400+DATE(1970,1,1)
The Unix timestamp is seconds since 1/1/1970 so birthdates before then would be negative. [one of the birthdates translates to 1901 - is that right? You'll have problems if any of the dates are before 1900 because Excel doesn't recognise those dates]
ok, I figured it out. This is the formula:
=(A1-(4*3600))/86400+25569