Questions tagged [python-datetime]

Python's built-in datetime module provides classes for manipulating dates and times in both simple and complex ways.

Python's built-in datetime module provides classes for manipulating dates and times in both simple and complex ways.

View on Python docs - for Python 2 and Python 3.

1880 questions
0
votes
1 answer

How to extract the data from the same date of two 3D datasets (time, lat, lon)?

I have two NetCDF files: Data1.shape = (177, 180, 360) Data2.shape = (179, 180, 360)) Date1= {list: 177}['2002-04', '2002-05', '2002-06', … ] Date2 = {list: 179}['2002-04', '2002-05', '2002-08', … ] I would like to filter/extract only those data…
Ehsan
  • 89
  • 9
0
votes
2 answers

Get a week number year number date code in the ISO 8601 calendar using Python

I need to get an ISO 8601 date that only displays the week number and two digit year code for a given date in python 3.0. This needs to be in the following format: YYWW (YY represents a two digit year code and WW represents the week number). I have…
0
votes
1 answer

Year wrongly read is System---YYYY is getting read as YY

I have a txt file which is tab separated. Few of the columns have date data in the format of "Dec-2011", "Jan-1994" etc the date ranges from "Jan-1944 to Dec-2015" Problem is the in original data the date format is "Jan-1994" or the year is in…
Rupanjan Nayak
  • 136
  • 1
  • 7
0
votes
0 answers

How to get corresponding pytz timezone name for a given location?

For example, if the given location name is "Battle Creek", then, we may able able to find its corresponding timezone details from this link. This link says that this location belongs to EST. But, it actually corresponds to pytz timezone name…
Balaraman L
  • 196
  • 2
  • 12
0
votes
1 answer

convert(float,getdate()) sql to time in python

I am parsing a .csv file in python. The file is saved from a different program, which uses sql to save a date column as convert(float,getdate())+2 in a column called 'lastupdated'. It looks like this: If I change the format to 'Time' in the .csv…
frisbeee
  • 71
  • 8
0
votes
0 answers

How to calculate active hours of an employee using face_recognition for attendance tracking

I am working on face recognition system for my academic project. I want to set the first time an employee was recognized as his first active time and the next time he is being recognized should be recorded as his last active time and then calculate…
asha A
  • 1
  • 2
0
votes
2 answers

Number of days between today and a negative year ("-2580,01,01", today")

I need to calculate the number of days between two dates. One will be today and the other one is -2580,01,01. I have tried with the datetime library but I can't because the datetime library don't accept negative years (MIN=1, MAX=9999). I have tried…
0
votes
3 answers

Can't convert time strings from csv to datetime

I have a csv file with 2 timestamps per row consisting of date, time and a value: 02.04.2019 00:30:30;02.04.2019 00:36:05;6354 02.04.2019 02:36:05;02.04.2019 03:41:40;3453 02.04.2019 03:41:40;02.04.2019 04:47:15;5456 When I try to convert date and…
ktw
  • 98
  • 9
0
votes
5 answers

Reindexing timeseries data

I have an issue similar to "ValueError: cannot reindex from a duplicate axis".The solution isn't provided. I have an excel file containing multiple rows and columns of weather data. Data has missing at certain intervals although not shown in the…
0
votes
0 answers

How to convert date- "2020-02-13" to UTC format like "2020-02-12 18:30:00" in python with aws batch

I am using the below code to convert INPUT(IST-Asia/Kolkata) time to UTC, it worked fine locally but didn't work on AWS batch. I am using pytz module. def get_utc_time(): fmt = "%Y-%m-%d %H:%M:%S" now_local = "2020-02-13" local_date =…
0
votes
1 answer

How to change an incorrect datetime format from a raw csv file to a proper datetime format in Python

I have a Python Dataframe like this Index Name Dateofbirth 0 A. 12JAN1980:00:00:00.000000 1 B. 17JUN1954:00:00:00.000000 ... 1250000 X. 09DEC1957:00:00:00.0000 The problem is that in the raw data csv file, my dates are stored in…
0
votes
1 answer

Reliably converting dataframe from EST (daylight savings time) to Japan standard time (no daylight savings time)

I have what I thought was a simple problem but it is becoming more confusing as I read more and browse the questions on this forum . I apologize if this has been asked earlier but so far I could not find out any source which treats both the steps…
Ramana
  • 243
  • 4
  • 15
0
votes
2 answers

Pandas series datetimes to timedeltas (seconds)

My Pandas dataframe has a sorted column of datetimes: print(df.Time) returns 0 2019-10-30 13:14:49 1 2019-10-30 13:15:25 2 2019-10-30 13:32:44 ... 997 2020-02-04 13:53:35 998 2020-02-04 14:22:46 999 …
0
votes
1 answer

Get name of a day from given day in specific format

I would like to find solution for converting date to day of the week (using Python). The day's format for example: '28 Jan 2020' should return Tuesday. I was looking for solution here, but couldn't find for this specific format. Does anybody can…
Frendom
  • 508
  • 6
  • 24
0
votes
0 answers

Add ceiling to datetime (non-fixed frequency)

I'm trying to add a ceiling to a resampled datetime index using Business Day frequency. I get this error: ValueError: <3 * BusinessDays> is a non-fixed frequency ceiling = df.index.ceil('3B') 2020-01-08 00:00:00 2020-01-13 00:00:00 2020-01-16…