Personally, when in  doubt I prefer the Unix timestamp, which can be stored as a straight number in a varchar or text field in a database and which – as far as I know – all systems can use.

 

Jason

 

From: Thomas White, MD, MS, MA [mailto:tw176@columbia.edu]
Sent: Tuesday, 9 August 2011 6:08 AM
To: limesurvey-developers@lists.sourceforge.net
Subject: [limesurvey-developers] date/time processing in JavaScript and PHP

 

All-

 

I'm trying to add support for Date and  Time datatypes, and functions that use them, within ExpressionManager.

 

JavaScript's native support for Date is quite limited. PHP is better, but uses quite different formatting strings from Java (which is what I'm most used to).

 

Since there is no native DateTime object in JavaScript , the most logical choice for a universal DateTime format seems to be ISO 8601 (like 2008-11-01T20:39:57.78-06:00).  Has the LimeSurvey team been planning towards a different DateTime standard?

 

JavaScript version 5 is supposed to have native support for ISO 8601, but most current browsers won't support it right now. I've seen several JavaScript and PHP libraries/functions for parsing and printing dates in ISO 8601 (and other) formats, but the most popular ones are not well maintained.  jQuery has a date picker API that seems to  support Java-formatted strings (and has a nice GUI), but doesn't parse/format dates as part of its API.

 

So, questions for the LimeSurvey team:

(1) Do you already use  or recommend particular Date/Time parsing/formatting functions (in JavaScript and PHP)

(2) Any objections to using ISO 8601 as an internal Date/Time standard (e.g. so can store it in that format in the database, but as a String instead of as a DateTime object)?

(3) Any strong preference for PHP vs. Java Date/Time formatting syntax?

 

/Tom