Latest Questions tagged Datetime

Browse all latest questions tagged Datetime

Published 29 Aug, 2022
Python - matplotlib bar chart with dates

I know about plot_date() but is there a bar_date() out there? The general method would be to use set_xticks and set_xticklabels, but I'd like something that can handle time scales from a few hours ou...

Published 18 Sep, 2022
Java - How to get the current date and time

How do I get the current date and time in Java? I am looking for something that is equivalent to DateTime.Now from C#.

Published 31 Aug, 2022
Python - Python datetime to microtime

I've looked all around, and there seem to be a lot of hacks, but no simple, "good" ways to do this. I want to convert a Python datetime object into microtime like time.time() returns (seconds.microsec...

Published 24 Apr, 2022
Python - Determine start and end time of current day (UTC -> EST -> UTC) ; Python

I am storing all my times in UTC and my system is set to UTC (though I am in EST). I have dates stored as: Wed, 20 Feb 2013 03:51:39 +0000 However, I would like to select information based off tod...

Published 01 May, 2022
Python - Convert Unix Timestamp to human format in Django with Python

I'd like to a convert unix timestamp I have in a string (ex. 1277722499.82) into a more humanized format (hh:mm:ss or similar). Is there an easy way to do this in python for a django app? This is ou...

Published 06 May, 2022
Python - Can't subtract offset-naive and offset-aware datetimes

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. The problem I'm having is that both datetim...

Published 26 Jun, 2022
Python - Average time for datetime list

Looking for fastest solution of time averaging problem. I've got a list of datetime objects. Need to find average value of time (excluding year, month, day). Here is what I got so far: import dateti...

Published 15 Sep, 2022
Java - How to subtract X day from a Date object in Java?

I want to do something like: Date date = new Date(); // current date date = date - 300; // substract 300 days from current date and I want to use this "date" How to do it?

Published 15 Sep, 2022
Java - See if the current time falls within a specific range of time in the current day in Java

I am sure this was done 1000 times in 1000 different places. The question is I want to know if there is a better/standard/faster way to check if current "time" is between two time values given in hh:m...

Published 24 Apr, 2022
Python - Python Pandas Group by date using datetime data

I have a column Date_Time that I wish to groupby date time without creating a new column. Is this possible the current code I have does not work. df = pd.groupby(df,by=[df['Date_Time'].date()])

Published 04 May, 2022
Python - Add n business days to a given date ignoring holidays and weekends in python

I'm trying to add n (integer) working days to a given date, the date addition has to avoid the holidays and weekends (it's not included in the working days)

Published 24 Apr, 2022
Python - Creating numpy linspace out of datetime

I'm writing a script that plots some data with dates on the x axis (in matplotlib). I need to create a numpy.linspace out of those dates in order to create a spline afterwards. Is it possible to do t...

Published 16 Apr, 2022
Javascript - What are valid Date Time Strings in JavaScript?

When using new Date or Date.parse in JavaScript, I cannot just pass arbitrary date formats. Depending on the format, I get a different date than I wanted to or even Invalid Date instead of a date obje...

Published 08 May, 2022
Python - How to get the same day of next month of a given day in python using datetime

i know using datetime.timedelta i can get the date of some days away form given date daysafter = + datetime.timedelta(days=5) but seems no datetime.timedelta(month=1)

Published 26 Jun, 2022
Python - Python set datetime to UTC timezone

I have an event I would like to trigger in Python, every weekend between Friday morning and Sunday morning. I have wrote some code that works on my local environment but I'm afraid when deployed to p...