Category "datetime"

Possible bug with getTransitions in PHP 8.1?

I know a lot of date-related bugs have been fixed in PHP 8.1, but it may have introduced new ones... Take this code: $time_zone_id = 'America/Vancouver'; $timeZ

How to change the datetime tick label frequency for matplotlib plots

Below shows a plot of simulated data, which contains the xticks that I want to modify. By default, the pd.df.plot chooses dates that are approximately 3 months

Laravel Carbon throws error The format separator does not match

I'm, trying to format a date into (Dayname Date Month) and I'm using Carbon for this but it return an error Carbon The format separator does not match here is a

Get current quarter in year with javascript

How can I get the current quarter we are in with javascript? I am trying to detect what quarter we are currently in, e.g. 2. EDIT And how can I count the numbe

How to get python to display current time (eastern)

How can I get Python to display the time in eastern? I've looked over the python documentation but it's pretty confusing. I'm using Python 3.

Adding two DateTime objects together

Is there any better way to add one DateTime object to another one, than this: DateTime first = new DateTime(2000, 1, 1); DateTime second = new DateTime(11, 2,

NameError: name 'UTC' is not defined

The output of datetime.datetime.now() outputs in my native timezone of UTC-8. I'd like to convert that to an appropriate timestamp with a tzinfo of UTC. from d

Python - Calculate the difference between two datetime.time objects

I have two datetime.time objects and I want to calculate the difference in hours between them. For example a = datetime.time(22,00,00) b = datetime.time(18,00,

Subtracting time.Duration from time in Go

I have a time.Time value obtained from time.Now() and I want to get another time which is exactly 1 month ago. I know subtracting is possible with time.Sub()

How to set multiple attributes for calender object at once?

This is my existing code snippet: Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.S

Serialize datetime.datetime object as JSON

Currently working on a quick little project in python and am attempting to encode an object into a JSON string. I've done this several times before without any

Why time format is changing in Azure Databricks

I have a file with a timestamp with time format as 2017-01-20 16:53:05.212 (yyyy-MM-dd HH:mm:ss.SSS). I have uploaded this file to Azure data lake gen 2 and acc

SQL - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I have been getting the following error when running a SQL to convert my data type value from varchar to datetime. Msg 242, Level 16, State 3, Line 1 The

How to monkeypatch python's datetime.datetime.now with py.test?

I need to test functions which uses datetime.datetime.now(). What is the easiest way to do this?

django filter by datetime on a range of dates

I have a model with field "created_at", and I have a list of dates. So, I want to get all the models that are created in the date range. How ? I know that w

DateTime vs DateTimeOffset

What is the difference between a DateTime and a DateTimeOffset and when should one be used? Currently, we have a standard way of dealing with .NET DateTimes in

How to show current time in JavaScript in the format HH:MM:SS?

How do I show the current time in the format HH:MM:SS?

How to get the total hour from starting time to end time in php

How can I get the total hour from start time to end time. $start_time = '11:00:00 PM'; // as of 07/08/2013 $end_time = '01:00:00 AM'; // as of 08/08/20

LocalDateTime - deserialization with LocalDateTime.parse

I have the field initiationDate which serialises by ToStringSerializer class to ISO-8601 format. @JsonSerialize(using = ToStringSerializer.class) private Local

Fetching rows added last hour

I keep a record of logins in a table. I have columns for id, ip, date and time. From that record of logins I wanna fetch logins made only in the last hour. I'