LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decoding a Date String

I want to decode date strings from a variety of different formats.  Of course not all date strings are unambiguous; but I want to handle a reasonable range of possibilities.

Here's what I've come up with:

dds.png

Suggestions appreciated.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 1 of 14
(2,232 Views)

This poses a new risk, many dates match more than one format, for example, 7/4/06 - this could be 7 Apr 2006 or 4 July 2006 or 6 Apr 2007 based on the user's location

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 14
(2,228 Views)

Hi Paul,

 

you forgot:

  • dd.mm.yy(yy) (or mm.dd.yy(yy)) formats using points as separators
  • dd. %b yy(yy) format (you might get into trouble with foreign language month names)
  • ISO8601 formatted timestamps…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 14
(2,205 Views)

I've seen YYYYMMDD before too (just one long string), which would just be %<%Y%m%d>T.

0 Kudos
Message 4 of 14
(2,195 Views)

@GerdW wrote:

Hi Paul,

 

you forgot:

  • dd.mm.yy(yy) (or mm.dd.yy(yy)) formats using points as separators
  • dd. %b yy(yy) format (you might get into trouble with foreign language month names)
  • ISO8601 formatted timestamps…

I don't want to encourage anyone to use dotted formats (for dates and phone numbers).

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 14
(2,175 Views)

New version

dds.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 14
(2,154 Views)

Hi Paul,

 


@paul_cardinale wrote:
I don't want to encourage anyone to use dotted formats (for dates and phone numbers).

But exactly those are standard in Central Europe! (Well, atleast for dates. Never seen phone numbers using dots.)

Tomorrow is 08.07.2022 for me…

 

With a big grin: when asking a worldwide forum for opinions you should not reject worldwide suggestions because of an US point of view… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 14
(2,144 Views)

@GerdW wrote:

Hi Paul,

 


@paul_cardinale wrote:
I don't want to encourage anyone to use dotted formats (for dates and phone numbers).

But exactly those are standard in Central Europe! (Well, atleast for dates. Never seen phone numbers using dots.)

Tomorrow is 08.07.2022 for me…

 

With a big grin: when asking a worldwide forum for opinions you should not reject worldwide suggestions because of an US point of view… 😄


Frozen_0-1657220975039.png

 

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
Message 8 of 14
(2,128 Views)

@Frozen wrote:

@GerdW wrote:

Hi Paul,

 


@paul_cardinale wrote:
I don't want to encourage anyone to use dotted formats (for dates and phone numbers).

But exactly those are standard in Central Europe! (Well, atleast for dates. Never seen phone numbers using dots.)

Tomorrow is 08.07.2022 for me…

 

With a big grin: when asking a worldwide forum for opinions you should not reject worldwide suggestions because of an US point of view… 😄


Frozen_0-1657220975039.png

 


NOTE: The following comment is entirely tongue-in-cheek

Yeah, but as an American, I feel obliged to not care

 

On a more serious note, I do prefer YYYY-MM-DD because it makes sorting a lot easier.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 14
(2,120 Views)

Hi,

 


@crossrulz wrote:

On a more serious note, I do prefer YYYY-MM-DD because it makes sorting a lot easier.


Me too!

(There's a reason why I mentioned ISO8601 in message #3…)

 


@crossrulz wrote:
Yeah, but as an American, I feel obliged to not care

Yes, I know. 😉

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 14
(2,111 Views)