All Questions
Tagged with unix-timestamp datetime
427
questions
0
votes
2
answers
50
views
pandas date column to unix timestamp accounting for timezone and varying datetime formats
I have multiple data frames with a datetime column as a string. Datetime formats vary across columns in the dataframe or across dataframes. I want to get a unix timestamp that gets interpreted by an ...
1
vote
1
answer
100
views
C# DateTime.Parse method losses nanosecond precision of the timestamp string
I need to convert an RFC-3339 formatted timestamp (e.g. "2024-01-04T14:30:00.119919872Z") to a unix nanosecond timestamp (e.g. 1704378600119919872). However, the C# DateTime structures ...
-2
votes
1
answer
187
views
What are all the known serialization formats of (unix) epoch time?
So, the basic definition of epoch time (similar to 'unix time', but not exactly: see below) and what it means is clear. However, nowhere on the wikipedia page or on any other resource I can find is it ...
0
votes
2
answers
166
views
Windows command prompt showing incorrect time since epoch
I am trying to monitor my app launch time on a Windows machine using command prompt. This is how I launch my electron app
powershell -command "(New-TimeSpan -Start (Get-Date "01/01/1970"...
0
votes
2
answers
91
views
Pandas to_datetime method giving incorrect year when converting Unix Timestamp
When using to_datetime method of Pandas Dataframe to convert a Unix Timestamp to a Formatted DateTime in a column of data collected from a Data Logger I get the wrong year by 20 years. I have checked ...
6
votes
1
answer
5k
views
How do you get the UTC time offset in Python now that utcnow() is deprecated? [duplicate]
I need the time difference in sec between my current location and UTC. It worked so well with (example timezone Berlin, UTC+1h) :
import datetime
datetime.datetime.utcnow().timestamp(): 1699017779....
0
votes
1
answer
128
views
PySpark Unix Time to yyyy-MM-dd HH:mm:ss.SSS
I want to convert epoch time in miliseconds to yyyy-MM-dd HH:mm:ss.SSS using PySpark. I tried below but I get weird conversion.
srcdf.withColumn("createdTime",from_unixtime(col("...
1
vote
1
answer
147
views
Understanding Unix Timestamps and Time Zone Conversion in Python
I'm having trouble understanding Unix timestamps and time zone conversions in Python. I have a UTC datetime string ('2023-09-20T05:04:54') and latitude/longitude coordinates (around Toronto). I need ...
0
votes
1
answer
46
views
Convert "Unix Epoch Time" to human readable time using time.gmtime raises OSError "invalid argument"
Converting Unix Epoch time to readable time information. Trials are as per below. It throws an error "OSError: [Errno 22] Invalid argument". Looks like the method does not like the given ...
0
votes
1
answer
46
views
Datetime / Unix Date convertor [duplicate]
I need an input prompt that will allow the user to enter a date at the point the function is called and then run to concert the date to Unix date for an API call later in the program.
At the moment ...
0
votes
2
answers
181
views
Unix time to regular date and time format using pyspark
I have unix time data from some logs, I want to transform then into regular dates and time
for example I have 1683825723389 and I get +553280424 or +55328-04-24 15:36:29
I tried:
.withColumn("...
1
vote
1
answer
380
views
Safely convert a Pandas datetime Series to Int64 epoch timestamp, preserving nulls
Consider a datetime-dtype Series containing some null values:
import pandas as pd
t = pd.date_range('2022-01-01', '2022-01-02', freq='4H').to_series('t')
t.iat[2] = None
2022-01-01 00:00:00 2022-...
0
votes
1
answer
302
views
Generate epoch time [duplicate]
I want to convert my time_stamp string into epoch time but I am not good with datetime and related modules, so getting a little confused. I saw many solutions but none of them had date_time format ...
0
votes
3
answers
617
views
How to get difference between current timestamp and a different timestamp?
I am trying get difference between two timestamps and check if its greater than 30 mins
timestamp1 = 1668027512
now = datetime.now(tz)
And this is what i am trying to do
from datetime import datetime
...
-1
votes
1
answer
786
views
Python: How to convert Timestamp which of precision 9 to datetime object?
I am fetching crypto data from the ByBit exchange which is returning the timestamp field created_at_e9 in the following format: 1663315207126761200
The standard is 11 -13 digits but here are 20 digits....