71,479 questions
-2
votes
0
answers
67
views
Unable to get the correct year for a UTC timestamp [closed]
I am trying to get a year, and time in UTC format for a particular time
I am able to print the time in the desired format but it is always printing wrong year , not sure if it prints the correct time ...
-3
votes
2
answers
153
views
String not recognized as a valid DateTime [closed]
I'm receiving this date and time in US format from an upstream server I have no control over and can't change: 12/16/2024 11:30:23 AM
I am trying to convert it to UK format using PowerShell:
[DateTime]...
0
votes
1
answer
60
views
Converting object to string in pandas [closed]
Hi I am new to learning data science and was just trying to play with a data set:
When I check the dtype of a column it shows as object. I want to convert it to a string so I can strip the components ...
1
vote
1
answer
104
views
Different epoch time from the same datetime
Here is my code:
import pandas as pd
import datetime
df = pd.DataFrame({'str_date': ['2023091004']})
df['epoch'] = pd.to_datetime(df['str_date'], format='%Y%m%d%H').astype(int) // 10**9
dt = ...
3605
votes
72
answers
7.0m
views
How do I format a date in JavaScript?
How do I format a Javascript Date object as a string? (Preferable format: 10-Aug-2010)
0
votes
2
answers
66
views
How to send a literal time to a Salesforce Time field from DataWeave without timezone conversion?
I'm using MuleSoft to send data to a Salesforce custom object. My object has a field named Shift_End_Time__c, and its data type is Time.
My source system provides this time as a string in UTC format, ...
-2
votes
1
answer
60
views
Timedelta Unit Argument as a Variable [duplicate]
Is it possible to have the units argument for the timedelta function be defined by a variable?
To elaborate, is this possible?
Time_Unit = "days"
Time_Increment = 1
Time2 = Time1 + ...
4
votes
2
answers
108
views
Django difference between aware datetimes across DST [duplicate]
I'm working on a Django application in which I need to calculate the difference between timestamps stored in the DB. This week I run into some problems related to DST.
In particular in the following ...
3
votes
1
answer
66
views
Explicit formatting of Format date/time regardless of operating system setting
As an an example:
print(os.date("%b"))
This prints "Oct" when running on a computer having date time settings set to English.
When using other language it prints "okt" (...
2857
votes
48
answers
3.6m
views
Compare two dates with JavaScript
Can someone suggest a way to compare the values of two dates greater than, less than, and not in the past using JavaScript? The values will be coming from text boxes.
3216
votes
40
answers
1.2m
views
Should I use the datetime or timestamp data type in MySQL?
Would you recommend using a datetime or a timestamp field, and why (using MySQL)?
I'm working with PHP on the server side.
2223
votes
47
answers
3.9m
views
How to return only the Date from a SQL Server DateTime datatype
SELECT GETDATE()
Returns: 2008-09-22 15:24:13.790
I want that date part without the time part: 2008-09-22 00:00:00.000
How can I get that?
3000
votes
26
answers
4.7m
views
Convert string "Jun 1 2005 1:33PM" into datetime
I have a huge list of datetime strings like the following
["Jun 1 2005 1:33PM", "Aug 28 1999 12:00AM"]
How do I convert them into datetime objects?
0
votes
1
answer
104
views
Combining two dataframes and keeping the average
I'm new to coding, and I'm trying to combine the data from two weather stations into one new dataframe sorted by Datetime. I want this new dataframe to contain the average values of the two original ...
1
vote
2
answers
101
views
How do I calculate a relative time delta in Pandas?
I have a column of datetimes and I want to get the difference between values in terms of years, months, etc, instead of timedeltas that only provide days. How do I do this in Pandas?
Pandas provides ...
1655
votes
42
answers
206k
views
Calculate relative time in C#
Given a specific DateTime value, how do I display relative time, like:
2 hours ago
3 days ago
a month ago
1318
votes
25
answers
1.7m
views
How to sort an object array by date property?
Say I have an array of a few objects:
var array = [{id: 1, date: Mar 12 2012 10:00:00 AM}, {id: 2, date: Mar 8 2012 08:00:00 AM}];
How can I sort this array by the date element in order from the date ...
2
votes
1
answer
138
views
What is NaT in Pandas?
I have a dataframe with some "NaT" values in a datetime column. What does that mean?
project status completed
0 windows done 2025-08-20
1 doors done 2025-08-21
2 hvac ...
1061
votes
14
answers
1.9m
views
Getting today's date in YYYY-MM-DD in Python?
Is there a nicer way than the following to return today's date in the YYYY-MM-DD format?
str(datetime.datetime.today()).split()[0]
936
votes
31
answers
1.5m
views
How do I get the day of week given a date?
I want to find out the following:
given a date (datetime object), what is the corresponding day of the week?
For instance, Sunday is the first day, Monday: second day.. and so on
And then if the ...
7
votes
2
answers
177
views
How to convert std::chrono::system_clock::now() to boost::mysql::datetime::time_point
I'm using the boost mysql library in a project. I need to use boost::mysql::datetime (datetime) to represent timestamps. A datetime value can be constructed from a boost::mysql::datetime::time_point.
...
1160
votes
20
answers
1.8m
views
Converting unix timestamp string to readable date
I have a string representing a unix timestamp (i.e. "1284101485") in Python, and I'd like to convert it to a readable date. When I use time.strftime, I get a TypeError:
>>>import ...
629
votes
50
answers
830k
views
How do I calculate the date six months from the current date using the datetime Python module?
I am using the datetime Python module. I am looking to calculate the date 6 months from the current date. Could someone give me a little help doing this?
The reason I want to generate a date 6 ...
626
votes
37
answers
1.3m
views
How to remove time portion of date in C# in DateTime object only?
I need to remove time portion of date time or probably have the date in following format in object form not in the form of string.
06/26/2009 00:00:00:000
I can not use any string conversion methods ...
1016
votes
25
answers
962k
views
How can I convert a Unix timestamp to DateTime and vice versa?
There is this example code, but then it starts talking about millisecond / nanosecond problems.
The same question is on MSDN, Seconds since the Unix epoch in C#.
This is what I've got so far:
...