2
$\begingroup$

I try to enter the following input, but receive an error message:

DateObject["12/1/2016", DateFormat -> {"Month", "/", "Day", "/", "Year"}]

enter image description here

despite having specified the date format explicitly, Mathematica is complaining about ambiguity of day and month ordering. I presume there is something wrong with the syntax I use. How should I be entering this command properly?

$\endgroup$
4
$\begingroup$

You've got DateFormat option the wrong way around: it controls output, not input.

What you want to do is actually the following (with day calendar granularity):

DateObject[{"12/1/2016", {"Month", "/", "Day", "/", "Year"}}, "Day"]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.