datetime

How to specify date and time in python?

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...

Sum time between dates in MySQL

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 ...

Getting Day from a Date Object

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 // } ...

Difference in months

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...

Formatting date string in Python for dates prior to 1900?

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. ...

ColdFusion Timezone Support?

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...

SQL - Help writing query

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 ...

Mysql Date SELECT

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. ...

Convert AD Timestamps to .Net DateTime

In active directory there are a bunch of INT64 fields (like lastlogintimestamp, accountexpires, etc) How do I convert these to datetime values in C#? ...

How do I format DateTime or TimeZone/TimeZoneInfo to display Three letters?

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...

Can NumericUpDown control do this?

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...

A better way to construct a datetime with higher precision than milliseconds

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...

How to convert human readable date to milliseconds since the unix epoch?

how to do this? ...

C# Connecting to Oracle DB DateTime formatting

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...

C# How would I check if a date that is currently a string is today?

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...

Recursion and return Dates in C#

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...

DateTimeFormatInfo.InvariantInfo vs CultureInfo.InvariantCulture

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...

.net parsing Iso8601 date time

I have a string "2009-10-08 08:22:02Z" which is iso8601 format. How do I use DateTime to parse this format ? ...

c# datetime 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...

mysql datetime field

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 ...