Jump to content
Ton Plomp

What are the most common date formatters?

Recommended Posts

For some parsing tool I am thinking about 'Error try' to parse date strings.

I am looking for the most common date formatter strings.

Pleas add yours:

  • %Y-%m-%dT%H:%M:%S
    2012-10-02T17:16:03

Share this post


Link to post
Share on other sites

DEC-12-2012 and 12-DEC-2012

Lots of Eastern Europe uses 12-XII-2012 or XII-12-2012, where the months are Roman numerals, which has the nice property of being language independent AND distinguishing the day from the month so order isn't ambiguous. I really like this one.

And there's always

December 12, 2012

Two digit years are rare these days, but depending upon your users, you might care.

Share this post


Link to post
Share on other sites

Lots of Eastern Europe uses 12-XII-2012 or XII-12-2012, where the months are Roman numerals, which has the nice property of being language independent AND distinguishing the day from the month so order isn't ambiguous. I really like this one.

I've never seen that before, but it's rather clever. I like it.

Share this post


Link to post
Share on other sites
  • %Y-%m-%dT%H:%M:%S
  • 2012-10-02T17:16:03

I most-often use something similar, but with decimal places for the seconds

  • %Y-%m-%dT%H:%M:%S%5u

  • 2012-10-23T17:16:03.12345

Lots of Eastern Europe uses 12-XII-2012 or XII-12-2012, where the months are Roman numerals...

Replace "Eastern Europe" with "Not North-Amreican" :)

For such dates, I usually use 12XII2012 (always have the day number 2 digits, month 3 letters, year 4 digits, so the hyphens are a waste bits).

Share this post


Link to post
Share on other sites

As a U.S. LabVIEW for Windows user, I most often see people use the the Format Date/Time String function with no input for default string (default is %c or locale specific). The Default locale info on Windows with a setting of English (United States) looks like this:

10/5/2012 1:10:42 PM

The equivalent LabVIEW string would be

%<%m/%d/%Y %I:%M:%S %p>T

In LabVIEW 8.6, the string I provided always includes two digits for the day, month and hours, yet the default output Format Date/Time String with the default %c returns two digits only when > 9.

10/5/2012 1:10:42 PM

10/05/2012 01:10:42 PM

Share this post


Link to post
Share on other sites

Our default is :

%<%Y%m%d_%Hh%Mm%S>T

most of our customers have no specific requirements about that and would accept anything we offer, we never needed sub-second in our applications.

Only once someone asked for week number.

Edited by Antoine Châlons

Share this post


Link to post
Share on other sites

Lots of Eastern Europe uses 12-XII-2012 or XII-12-2012, where the months are Roman numerals, which has the nice property of being language independent AND distinguishing the day from the month so order isn't ambiguous. I really like this one.

I'm from Europe (And have been to eastern europe) and I would have to say that I've never seen this formatting before. Can NI output this with standard formatters?

Shane

Share this post


Link to post
Share on other sites

I'm from Europe (And have been to eastern europe) and I would have to say that I've never seen this formatting before. Can NI output this with standard formatters?

Shane

I've seen this in Italy, nowhere else.

Share this post


Link to post
Share on other sites

Lots of Eastern Europe uses 12-XII-2012 or XII-12-2012, where the months are Roman numerals, which has the nice property of being language independent AND distinguishing the day from the month so order isn't ambiguous. I really like this one.

I'm from Europe (And have been to eastern europe) and I would have to say that I've never seen this formatting before. Can NI output this with standard formatters?

As a citizen of country frequently considered as Eastern Europe (being in fact Central Europe), I can say that we very often use this format in handwriting, but I have never seen it in any application...

Share this post


Link to post
Share on other sites

I'm very disappointed you didn't say "%^<%Y-%m-%dT%H:%M:%S%3uZ>T" :rolleyes:

/J

Well, the original question was "What are the most common date formatters?" not the most useful date formatter. :P

Maybe someone else here could chime in regarding Oracle, but I just spent the last three hours querying and dumping results using Oracle Apps and the date/time format was:

09-OCT-2012 08:59:28

which works out to

%<%d-%b-%Y %H:%M:%S>T

except for the capitalization. I'm guessing that the month name is localized to the default language setting for the profile of the user...

  • Like 1

Share this post


Link to post
Share on other sites

Regarding the Roman numeral month...

A) No, I don't think NI has any way to do it with the standard formatters.

B) I've seen it on lots of buildings for things like memorial markers (Serbia, Czech Republic) and I saw it on my ticket stub in Ukraine (Kiev), which was computer printed. The other examples I've seen were all handwritten.

Share this post


Link to post
Share on other sites

%^<%j/   %H:%M:%S>T[/CODE]

[CODE]%^<%j:%H:%M:%S>T[/CODE]

287/ 23:15:42

287:23:15:42

Day of year, 24hr UTC. It is how things are scheduled on the International Space Station, TDRSS satellites, etc.

I think files usually use the second format, displays use the first.

Share this post


Link to post
Share on other sites

Here is mine.

post-8614-0-06242100-1351112736.png

The thing to be careful is not use characters that operating systems don't like i.e. "/" I use this to create a data/time stamp for a file name. This guarantees a unique file name

Edited by ASTDan

Share this post


Link to post
Share on other sites

The thing to be careful is not use characters that operating systems don't like i.e. "/" I use this to create a data/time stamp for a file name. This guarantees a unique file name

How do you make sure this will never run more than once a minute?

(allright I have a simular one, that adds seconds, and I never make sure it runs just ones a second).

Ton

Share this post


Link to post
Share on other sites
How do you make sure this will never run more than once a minute?
The usual solution is to have a sequence counter in your application that increments while the app is running and the sequence number is appended to the end of the file name so that names are unique within a minute/second/whatever. If you need something that is unique globally (i.e. multiple machines generating files simultaneously that may then be shared with each other), adding a random number of sufficient length to the end is the generally accepted solution, provided you use something for your random number seed *other* than the clock. :-)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.