Message Boards Message Boards

0
|
587 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Error converting Date string to Date Object

Posted 4 months ago

Can someone help explain this error occurring with some string dates and not with other?

There are a number of strings where I get this response

FromDateString["12/11/2023"]
FromDateString::ambig: Warning: the interpretation of the string 12/11/2023 as a date is ambiguous.

For others like "12/12/2023" or "4/15/2023" a Dateobject is returned without a message

What do I need to do differently?
Thanks
Pat

POSTED BY: Patrick Brooks
2 Replies

In Italy, "12/11/2023" means the 12th of november. In the US they have the bizarre custom of reading it as the 11th of december.

POSTED BY: Gianluca Gorni
Posted 4 months ago

I think I figured it out. The ambiguity was Mathematica not knowing which part of the string was a month and which part of the string was a day.

Once I specified {"Month", "/", "Day","/","Year} the error was cleared.

POSTED BY: Patrick Brooks
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract