Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

datetime

pytz localize vs datetime replace

August 17, 2022 by Magenaut

I’m having some weird issues with pytz’s .localize() function. Sometimes it wouldn’t make adjustments to the localized datetime:

Categories Python, Q&A Tags datetime, python, pytz, timezone, utc Leave a comment

How to convert a timezone aware string to datetime in Python without dateutil?

August 17, 2022 by Magenaut

I have to convert a timezone-aware string like "2012-11-01T04:16:13-04:00" to a Python datetime object.

Categories Python, Q&A Tags datetime, python, rfc3339, timezone Leave a comment

How to increment a datetime by one day?

August 17, 2022 by Magenaut

How to increment the day of a datetime?

Categories Python, Q&A Tags datetime, python Leave a comment

Convert datetime to Unix timestamp and convert it back in python

August 17, 2022 by Magenaut

I have dt = datetime(2013,9,1,11), and I would like to get a Unix timestamp of this datetime object.

Categories Python, Q&A Tags datetime, python, timestamp Leave a comment

pandas out of bounds nanosecond timestamp after offset rollforward plus adding a month offset

August 17, 2022 by Magenaut

I am confused how pandas blew out of bounds for datetime objects with these lines:

Categories Python, Q&A Tags datetime, datetimeoffset, pandas, python Leave a comment

Can’t subtract offset-naive and offset-aware datetimes

August 17, 2022 by Magenaut

I have a timezone aware timestamptz field in PostgreSQL. When I pull data from the table, I then want to subtract the time right now so I can get it’s age.

Categories Python, Q&A Tags datetime, postgresql, python, timezone Leave a comment

Convert timedelta to years?

August 17, 2022 by Magenaut

I need to check if some number of years have been since some date. Currently I’ve got timedelta from datetime module and I don’t know how to convert it to years.

Categories Python, Q&A Tags datetime, python, timedelta Leave a comment

What’s the best way to find the inverse of datetime.isocalendar()?

August 17, 2022 by Magenaut

The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime object. Is there a corresponding inverse function? If not, is there an easy way to compute a date given a year, week number and day of the week?

Categories Python, Q&A Tags datetime, python Leave a comment

How to format date string via multiple formats in python

August 17, 2022 by Magenaut

I have three date formats: YYYY-MM-DD, DD.MM.YYYY, DD/MM/YYYY.

Categories Python, Q&A Tags date, datetime, format, python, strptime Leave a comment

Get current time in milliseconds in Python?

August 17, 2022 by Magenaut

How can I get the current time in milliseconds in Python?

Categories Python, Q&A Tags datetime, python, time Leave a comment
Older posts
Newer posts
← Previous Page1 … Page12 Page13 Page14 … Page20 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress