Python Forum
Convert date integers (ex. 43831) to regular format
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert date integers (ex. 43831) to regular format

I'm currently learning Python 3 and I am struggling with converting date integers into another format.
The dates have the format 43831, 43832, etc. 43831 being 01-01-2020.

What line of code I need to use to convert my whole column into, let's say, a date format "dd-mm-yyyy"?

[Image: Capture.png]
Screenshot if the above deson't work:
I tried things, in vain.

Thank you.
post your code, sample input, expected output, full error traceback as text, using proper BBCode tags.
Don't post images.
See BBcode help for more info.
Are these comming from Excel?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Something like this would be a start...

>>> from datetime import datetime,timedelta
>>> (datetime(1900, 1, 1) + timedelta(days=43831-2)).strftime("%d-%m-%Y")

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I compare 2 format of date? korenron 4 267 Dec-21-2021, 12:40 PM
Last Post: korenron
  Date format and past date check function Turtle 5 724 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  Print first day of the week as string in date format MyerzzD 2 587 Sep-29-2021, 06:43 AM
Last Post: MyerzzD
  Convert timedelta to specified format Planetary_Assault_Systems 3 1,058 Jun-27-2021, 01:46 PM
Last Post: snippsat
  How to convert dates in odd format to months lokhtar 2 926 Apr-17-2021, 11:54 AM
Last Post: lokhtar
  String to Date format SAF 2 1,153 Apr-06-2021, 02:09 PM
Last Post: snippsat
  Convert email addresses to VCF format jehoshua 2 2,480 Mar-06-2021, 12:50 AM
Last Post: jehoshua
  How to add previous date infront of every unique customer id's invoice date ur_enegmatic 1 1,022 Feb-06-2021, 10:48 PM
Last Post: eddywinch82
  CPC File Format (Cartesian Perceptual Compression) - Can Python Convert / Handle Them PSKrieger 2 1,062 Nov-11-2020, 02:57 PM
Last Post: PSKrieger
Thumbs Up Convert ActiveDirectory timestamp into regular one. Arrow (solved) SpongeB0B 2 744 Nov-02-2020, 08:34 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020