Questions tagged [datetime]
A DateTime object in many programming languages describes a date and a time of day. It can express either an instant in time or a position on a calendar, depending on the context in which it is used and the specific implementation. This tag can be used for all date and time related issues.
datetime
71,252
questions
0
votes
5
answers
9k
views
SQL Server 2005 vs. ASP.net datetime format confusion
I've found a similar question on stack overflow, but it didn't really answer the question I have. I need to make sure that my asp.net application is formatting the date dd/mm/yyyy the same as my SQL ...
11
votes
4
answers
12k
views
Simplest way to create a date that is the first day of the month, given another date
In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get ...
44
votes
4
answers
49k
views
How do I use timezones with a datetime object in python?
How do I properly represent a different timezone using the datetime module? The following example using myTimeZone() only works because I know that EDT is one hour ahead of me. What is the replacement ...
5
votes
10
answers
17k
views
C++ timing, milliseconds since last whole second
I'm working on a C++ application that needs detailed timing information, down to the millisecond level.
We intend to gather the time to second accuracy using the standard time() function in <...
78
votes
16
answers
198k
views
Converting a year from 4 digit to 2 digit and back again in C#
My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing:
I put a DropDownList of the 4-digit year on the page.
I validate ...
1040
votes
19
answers
863k
views
Given a DateTime object, how do I get an ISO 8601 date in string format?
Given:
DateTime.UtcNow
How do I get a string which represents the same value in an ISO 8601-compliant format?
Note that ISO 8601 defines a number of similar formats. The specific format I am ...
2188
votes
47
answers
3.8m
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?
79
votes
7
answers
73k
views
What does "DateTime?" mean in C#?
I am reading a .NET book, and in one of the code examples there is a class definition with this field:
private DateTime? startdate
What does DateTime? mean?
4
votes
5
answers
14k
views
How do I work with quarters (quarterly dates) in ASP.Net using VB.Net 2.0?
I know that Sql Server has some handy built-in quarterly stuff, but what about the .Net native DateTime object? What is the best way to add, subtract, and traverse quarters?
Is it a bad thing™ to use ...
537
votes
11
answers
576k
views
What is the standard way to add N seconds to datetime.time in Python?
Given a datetime.time value in Python, is there a standard way to add an integer number of seconds to it, so that 11:34:59 + 3 = 11:35:02, for example?
These obvious ideas don't work:
>>> ...
54
votes
14
answers
142k
views
How do I convert a date/time to epoch time (unix time/seconds since 1970) in Perl?
Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT?
Bonus question: If given ...
10
votes
15
answers
2k
views
What languages do date, time, and calendar operations really well? [closed]
This is probably too much to ask, but is there any language that does a really terrific job of representing time and date operations? I'll grant straight away that it's really hard to write a truly ...
4
votes
11
answers
3k
views
How would I store a date that can be partial (i.e. just the year, maybe the month too) and output it later with the same specifity?
I want to let users specify a date that may or may not include a day and month (but will have at least the year.) The problem is when it is stored as a datetime in the DB; the missing day/month will ...
3
votes
3
answers
2k
views
Date Component Manipulation
Is it possible to manipulate the components, such as year, month, day of a date in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.
22
votes
10
answers
25k
views
What's the best way to manipulate Dates and Timestamps in Java?
Every time I need to work with date and/or timstamps in Java I always feel like I'm doing something wrong and spend endless hours trying to find a better way of working with the APIs without having to ...