Category "datetime"

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'

How to preserve timezone when parsing date/time strings with strptime()?

I have a CSV dumpfile from a Blackberry IPD backup, created using IPDDump. The date/time strings in here look something like this (where EST is an Australian ti

How to use REGEXEXTRACT for day and time?

I am using a third-party app that allows me to log in my day, time and location at the push of a button, on a google sheet. (source: imggmi.com) While the app c

Python: get all months in range?

I want to get all months between now and August 2010, as a list formatted like this: ['2010-08-01', '2010-09-01', .... , '2016-02-01'] Right now this is what

Python: get all months in range?

I want to get all months between now and August 2010, as a list formatted like this: ['2010-08-01', '2010-09-01', .... , '2016-02-01'] Right now this is what

Python: get all months in range?

I want to get all months between now and August 2010, as a list formatted like this: ['2010-08-01', '2010-09-01', .... , '2016-02-01'] Right now this is what