Converting UTC timestamp to a time value? [duplicate] - excel

This question already has answers here:
Excel date to Unix timestamp
(11 answers)
Closed 5 years ago.
I'm doing an exercise where I have data with several entries of this type:
"started_at": 1475499600.287,
Which is defined as:
started_at: when the interval started, UTC Time
Ok, how can I convert it to a meaningful time (using Excel, for example) in some format (e.g. dd/mm/yyyy hh:mm:ss)?

For translating into GMT, you can use
=(((A1/60)/60)/24)+DATE(1970,1,1)
Your example time will become 03/10/2016 13:00:00
Make sure to format the cell dd/mm/yyyy hh:mm:ss

Related

Converting Dates - What format is 20130606T083000.093660900? [duplicate]

This question already has an answer here:
How to convert string format date yyyymmddThhmmss.sss to date in Bash?
(1 answer)
Closed 6 months ago.
Bit of an issue with date formatting:
Looking to format this date format " 20130606T083000.093660900 "
2013 06 06 T 08 30 00. 093660900
YYYY MM DD T HH MM SS NANOSECS
Formatting this into Epoch (which I believe is the second time given below without decimals) time would be great, I don't have much experience working with date time and changing them.
My goal is to realistically subtract
20130606T083000.093660900 FROM 1370507400093660900
Any help with even telling me what format the first date is, as it is apparently NOT ISO 8601, thanks!
You can use sed to convert the input to something GNU date can parse, then use GNU date to convert it to the format of the other date. Then compare:
din='20130606T083000.093660900'
dcmp='1370507400093660900'
dstr=$(sed 's/\(..\)\(..\)T\(..\)\(..\)/-\1-\2T\3:\4:/' <<<"$din")
timestamp=$(TZ=UTC0 date +%s%N --date="$dstr")
diff=$(( dcmp - timestamp ))
# diff is now: 0
I have forced timezone to avoid localisation concerns.

pd.Timestamp changing month and day field when day <=12 [duplicate]

This question already has answers here:
pd.to_datetime is getting half my dates with flipped day / months
(2 answers)
Closed 3 years ago.
I'm doing some data analysis using Pandas in a Jupyter notebook and analysing minute by minute data for a 2 year period. There's about 740,000 rows of data pulled in from a csv file (pd.read_csv('file location'))
Format of date_time: "dd/mm/yyyy hh:mm" - i.e. 11/01/2017 21:52
Here's something weird I've found, when day<=12, the day and month switch, when the day is 13 and above the format is correct (when put through pd.Timestamp)
An example:
pd.Timestamp("13/02/2018 02:26")
--> Timestamp('2018-02-13 02:26:00')
As you'd expect. Now taking it to 11th February:
pd.Timestamp("12/02/2018 02:26")
--> Timestamp('2018-12-02 02:26:00')
Really unsure why this happens, would really appreciate some help on how I can avoid this happening.
Thank you!
Check with to_datetime and dayfirst
pd.to_datetime("11/02/2018 02:26",dayfirst=True)
Out[22]: Timestamp('2018-02-11 02:26:00')

Linux Shell Script - Date format not working [duplicate]

This question already has answers here:
GNU date and custom formats
(2 answers)
Closed 4 years ago.
I am getting date in following format from a system and I need to use it for calculating some time difference.
Input format - 30-MAR-18 01.40.04.812030 AM PST
I am using following code but I am getting format errors.
#!/usr/bin
start_string="30-MAR-18 01.40.04.812030 AM PST"
TZ=GMT date --date="$start_string" "+%s"
#Above line is just to convert into seconds and print
This throws the error "date: invalid date ‘30-MAR-18 01.40.04.812030 AM PST’"
I am lost on how to convert this into date format and then use it.
All help appreciated.
This is different from question asked here because I am dealing with an input that has a "." and not a ":" as the time separator.
Give the format like this:
start_string="30-MAR-18 01:40:04.812030 AM PST"

Convert epoch time to readable time in excel [duplicate]

This question already has answers here:
Converting unix time into date-time via excel
(7 answers)
Closed 5 years ago.
I have a excel sheet where in column (G) there is a timestamp but is in epoch format, how can i convert epoch time to readable time format in excel.
I have already tried =TEXT(G2,"DD/MM/YYY HH:MM:SS") but it didn't work.
Try this:
=TEXT((G2/1000 + ("1/1/1970"-"1/1/1900"+1)*86400) / 86400,"DD/MM/YYYY HH:MM:SS")

Excel: transform TEXT like "YYYYMMDD" to DATE [duplicate]

This question already has answers here:
Excel Date Conversion from yyyymmdd to mm/dd/yyyy
(5 answers)
Closed 8 years ago.
How can I transform a column with text like "20130213" to DATE?
Basically, I need to calculate the difference in days between 2 dates that come in the text format
Thanks a lot
You can use for example
=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))

Resources