datetime

Reliable strtotime() result for different languages

There was always a strange bug in Joomla when adding new article with back-end displayed with a language other than English (for me it's Russian). The field "Finish Publishing" started to be current date instead of "Never" equivalent in Russian. For a site in php4 finally found that strtotime function returns different results for arbi...

Binary to Date (C#) 64 Bit Format

We have a binary file from which we have identified the following dates (as Int64). We now the following facts about the Date/Time format; The 64 bit Date has a resolution to the microsecond The 64 bit Date has a range of 4095 years The Int64 9053167636875050944 (0x7DA34FFFFFFFFFC0) = 9th March 2010 The Int64 9053176432968073152 (0x7DA...

Regular Expression DateTime Javascript

I need an expression which matches,DateTime format (DD/MM/YYYY),i've already found it. However,it only works to (1/6/2009) or (1/5/2010),it doenst support (01/06/2009) or (01/05/2010). How can i check if a string is a dateTime in Javascript? ...

In PHP given an extended date string, how can I extract the month Year in long format?

My attempted solution was: $date = "Nov 30 2009 03:00:00:000PM"; echo date("F Y", strtotime($date)); Expected result should be: "November 2009" Any other simple solutions? ...

How do I check if a given datetime object is "between" two datetimes?

my_event = Event.objects.get(id=4) current_time = datetime.datetime.now() How do I do check if my current time is between them? my_event.start_time < current_time < my_event.end_time ...

Java vs c++ types

I've recently had a question about coledatetime java implementation, and Chris said, that the problem might lay in type conversions: cpp-float vs java-float (Or maybe cpp-date vs java-date. Not types, but..). Now I have several questions on this: Is there a table of comparison for java vs c++ types? If type conversions is the problem, ...

The woes of (sometimes) storing "date only" in datetimes

We have two fields from and to (of type datetime), where the user can store the begin time and the end time of a business trip, e.g.: From: 2010-04-14 09:00 To: 2010-04-16 16:30 So, the duration of the trip is 2 days and 7.5 hours. Often, the exact times are not known in advance, so the user enters the dates without a time: From: ...

DateTime.ParseExact fails depending on the parsed string's length...

This is very weird. I have the following code: Assert.AreEqual(new DateTime(2000, 1, 1), DateTime.ParseExact("2000", "yyyy", CultureInfo.InvariantCulture)); Assert.AreEqual(new DateTime(2000, 1, 1), DateTime.ParseExact("20000705", "yyyy", CultureInfo.InvariantCulture)); The first line passes, the second one fails with "System.FormatEx...

UTC DateTime to Unix timestamp

How can I convert UTC date time to seconds since Epoch using MS VBA lanugage? ...

C++: Converting Julian dates to Gregorian

I need to write a function that converts a Julian dates (Year, Day of Year, Hour of Day and Minutes) into a standard form (Year, Month, Day of Month, Hour of Day and Minutes) and express it as a string. I figure there's got to be someone who's already written a library or component which can do the conversion from Day Of Year to Month a...

DateTime Property not firing PropertyChanged event when changed

I'm working on a WPF MVVM application and I've got a TextBox on my view that is bound to a DateTime property on the ViewModel. Seems simple enough, but when I clear the text in the TextBox, the property never changes. In fact, it never even fires until I begin typing "4/1..." and then it fires. What can I do to fix this? Obviously I ...

Display rows from MySQL where a datetime is within the next hour

I always have trouble with complicated SQL queries. This is what I have $query = ' SELECT id, name, info, date_time FROM acms_events WHERE date_time = DATE_SUB(NOW(), INTERVAL 1 HOUR) AND active = 1 ORDER B...

Problem using date when querying the appengine datastore

I'm running this query: SELECT FROM com.Data WHERE entryDate > DATE('2010-3-16') I get this error: org.datanucleus.store.appengine.query.DatastoreQuery$UnsupportedDatastoreFeatureException: Problem with query DATE('2010-3-16')>: Unsupported method while parsing expression: InvokeExpression{[null].DATE(Literal{2010-3-16})} The same ...

Java TimeZones: how to get UTC time values based on Console settings?

For example, when I extract from a database a Date() variable, it contains a date with "+04:00" shift. According to my locale's settings. So, UTC time is "ourTime" MINUS 4 hours. Then, a user tells where he/she is from. Now, we need to save his/her shift. LET'S SAY it is -01:00. And finally, this user tells us where's he/she is headin...

Safely convert UTC datetimes to local time (based on TZ) for calculations?

Following from my last question which @Jon Skeet gave me a lot of help with (thanks again!) I am now wondering how I can safely work with date/times, stored as UTC, when they are converted back to Local Date/Time. As Jon indicated in my last question using DateTimeOffset represents an instant in time and there is no way to predict wha...

Delphi DateTimeFormat returning wrong year

I have a form that allows users to enter a date of birth: ie: 4/16/40 Then when the user processes the form there's a function that checks it's length, adds leading zeros, parses the date and then uses FormatDateTime to just return the year of birth: strTemp := strPostedByDOB; If Length(strTemp) = 5 then strTemp = '0' + strTemp; if...

How can I convert DateTime "Thu Nov 30 19:00:00 EST 2006" to "11/30/2006"

How can I convert DateTime "Thu Nov 30 19:00:00 EST 2006" to "11/30/2006" ...

Can't parse a 1904 date in ARPA format (email date)

I'm processing an IMAP mailbox and running into trouble parsing the dates using the mxDateTime package. In particular, early dates like "Fri, 1 Jan 1904 00:43:25 -0400" is causing trouble: >>> import mx.DateTime >>> import mx.DateTime.ARPA >>> mx.DateTime.ARPA.ParseDateTimeUTC("Fri, 1 Jan 1904 00:43:25 -0400").gmtoffset() Traceback (mos...

Proper way to format date from database using javascript/jquery

Hi all, I am calling my database which contains a datetime datatype. The date looks like this: 2005-05-23 16:06:00.000 I would like to display this in a table when a user selects a certain item from a list. I call my controller action and return Json of all the times and put them in a table. The problem is the date is completely wrong...

help in compare validate in c#

i have 2 textboxes that i am filling with StartDate, and Endate. i want to use the compareValidator to make sure that the StartDate is less that the EndDate. i used this: <asp:CompareValidator ID="Comp" ControlToValidate="txtStartDate" ControlToCompare="txtEndDate" Operator="LessThan" Type="Date" runat="server" Display="dynamic" Tex...