Skip to content

Magenaut

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

datetime

How to truncate the time on a datetime object?

August 16, 2022 by Magenaut

What is a classy way to way truncate a python datetime object?

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

matplotlib bar chart with dates

August 16, 2022 by Magenaut

I know about plot_date() but is there a bar_date() out there?

Categories Python, Q&A Tags bar-chart, datetime, matplotlib, python Leave a comment

Datetime Timezone conversion using pytz

August 16, 2022 by Magenaut

This is just another post on pytz.

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

python pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working

August 16, 2022 by Magenaut

I import a dataframe via read_csv, but for some reason can’t extract the year or month from the series df['date'], trying that gives AttributeError: 'Series' object has no attribute 'year':

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

Convert timedelta to total seconds

August 16, 2022 by Magenaut

I have a time difference

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

Generate a list of datetimes between an interval

August 16, 2022 by Magenaut

Given two datetimes (start_date and end_date), I’d like to generate a list of other datetimes between these two dates, the new datetimes being separated by a variable interval. e.g. every 4 days between 2011-10-10 and 2011-12-12 or every 8 hours between now and tomorrow 19p.m.

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

Python datetime to string without microsecond component

August 16, 2022 by Magenaut

I’m adding UTC time strings to Bitbucket API responses that currently only contain Amsterdam (!) time strings. For consistency with the UTC time strings returned elsewhere, the desired format is 2011-11-03 11:07:04 (followed by +00:00, but that’s not germane).

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

Python datetime formatting without zero-padding

August 16, 2022 by Magenaut

Is there a format for printing Python datetimes that won’t use zero-padding on dates and times?

Categories Python, Q&A Tags datetime, formatting, python, zero-pad Leave a comment

Converting epoch time with milliseconds to datetime

August 16, 2022 by Magenaut

I have used a ruby script to convert iso time stamp to epoch, the files that I am parsing has following time stamp structure:

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

How to add timezone into a naive datetime instance in python

August 16, 2022 by Magenaut

The first is to use the localize() method provided by the pytz library. This is used to localize a naive datetime (datetime with no timezone information):

Categories Python, Q&A Tags datetime, python, pytz, timezone Leave a comment
Older posts
Newer posts
← Previous Page1 … Page14 Page15 Page16 … 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