Quite simple newbie question:
What is the object used in python to specify date (and time) in Python?
For instance, to create an object that holds a given date and time, (let's say '05/10/09 18:00').
EDIT
As per S.Lott request, what I have so far is:
class Some:
date =
I stop there, after the "=" sign for I realize I didn't kn...
I have a MySQL table looking like this. It's basically a time sheet for tasks.
id | task | user | start | stop | running
------+--------+--------+-----------------------+-----------------------+-----------
1 | 12 | 2 | 2009-10-01 10:05:00 | 2009-10-01 14:23:00 | 0
1 | 13 ...
I wanna see if someDate has any day in it. Am I checking it right?
Calendar cal = Calendar.getInstance();
cal.setTime(someDate); // someDate is a Date
int day = cal.get(Calendar.DAY_OF_MONTH);
if(day == 0){
// code //
}
...
In C#/.NET TimeSpan has TotalDays, TotalMinutes, etc. but I can't figure out a formula for total months difference. Variable days per month and leap years keep throwing me off. How can I get TotalMonths?
Edit Sorry for not being more clear: I know I can't actually get this from TimeSpan but I thought using TotalDays and TotalMinutes wou...
Can anyone explain the best way to format a date time string in Python where the date value is prior to the year 1900? strftime requires dates later than 1900.
...
Does ColdFusion 8 have any built-in support for handling timezones? We'd like our users to be able to choose a timezone and then have all dates/times on the site adjusted to their locale. Currently we're asking users to set an offset from server time, and it's a headache because they have to go in a couple times each year and manually ad...
Hi,
I'm sure how to do this and was looking for some help. In SQL, I need a query that goes like this Get all people Ids who's last order date is larger then x(a predefined date). I've tried using Max() but it doesn't seem to be working right.
thanks
...
I'm trying to select all dates that haven't pass the current date. So for instance, I want to display every date after 2009-10-06 and NOT dates prior 2009-10-06.
...
In active directory there are a bunch of INT64 fields (like lastlogintimestamp, accountexpires, etc)
How do I convert these to datetime values in C#?
...
I'm working with a spec that calls for a peculiar Datetime format that I haven't necessarily had to work with yet.
At Process time, an OFX (1 not 2) datetime must be stamped (either DTCLIENT or DTSERVER) in a format like this:
20071015021529.000
however, in the examples it is shown:
20071015021529.000[-8:PST]
I don't have a prob...
Hi All,
I'm experimenting with the NumericUpDown control and have a question regarding its' flexibility. Basically, what I would like to do is display year ranges like so:
2006-2007;
2007-2008;
2008-2009;
2009-2010
Obviously, I would like the control to cycle through a range similar to this when the buttons are pushed.
If this is po...
I have just gone through an unexpectedly convoluted process to define datetimes.
The underlying data has a better precision than milliseconds.
I ended up constructing an intermediate datetime to the nearest second, reading it's value in ticks (10 000 to the millisecond), adjusting the ticks then creating the datetime that I actually wa...
Hello,
I have a .Net webapp that is connecting to an Oracle backend.
I have a base page which every page uses where I set my
protected override void OnPreInit(EventArgs e)
{
System.Globalization.CultureInfo cultureInfo =
new System.Globalization.CultureInfo("en-CA");
// Creating the DateTime Information specific t...
Hi,
I have a date that is in a format called 'String(Generalized-Time)', see MSDN below, I need to check if this date is today and if it is do X.
http://msdn.microsoft.com/en-us/library/ms684436%28VS.85%29.aspx
To complicate this slightly I have a int that is in this example 4, if the int is 4 then I want to check if the date that is...
Hello,
I can't get this method to return the right date. What this method does is take the current date and add the amount of days you specify. So if you want the next Monday, it'll return the next Monday. It also sends the date into a method that checks to see if it's one of the "Filtered Dates" that aren't allowed to be returned. This...
I am trying to parse DateTime, with an exact format being accepted from client input.
Which one is better
bool success = DateTime.TryParseExact(value, "dd-MMM-yyyy",
DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out dateTime);
OR
bool success = DateTime.TryParseExact(value, "dd-MMM-yyyy",
CultureInfo.InvariantCultur...
I have a string "2009-10-08 08:22:02Z" which is iso8601 format.
How do I use DateTime to parse this format ?
...
I wish to have a specific format for my DateTime depending on the current culture.
So I try this:
dateTime.ToString("dd/MM/yyyy hh:mm");
This is partially OK, the / gets replaced by the culture-specific separator. But the day and month order are not switched (like MM/dd) depending on the culture.
Using .ToString("g") works, but tha...
I'm parsing a feed that contains a "created at" entry, formatted like this:
Thu, 08 Oct 2009 23:01:33 +0000
I need to be able to store this in a MySQL table, in a DateTime datatype. Then, I want to select rows WHERE datetime clause equals or in range between dates and/or times.
I have two questions:
Will this string be acceptable ...