1
$\begingroup$

I cannot find it in the documentation, what is the default form of hour in the DateList when the form {y,m,d,h,m,s} is used. I would assume 24 hour system since there is no am/pm specification, but it is american software so I am not sure...

$\endgroup$
1
  • $\begingroup$ why don't you just try it and see? $\endgroup$
    – lericr
    Apr 4, 2022 at 17:27

1 Answer 1

3
$\begingroup$

It's the 24h format. This can be easily checked by running:

dates = {"04/04/2022 6:20:23 PM", "04/04/2022 6:20:23",
  "04/04/2022 6:20:23 AM", "04/04/2022 18:20:23"};
DateList /@ dates

(* {{2022,4,4,18,20,23.}, {2022,4,4,6,20,23.}, {2022,4,4,6,20,23.}, {2022,4,4,18,20,23.}} *)

Note that the hour format accepts hours >24, which then gets added to the day in the output.

DateList[{2022, 4, 4, 26, 20, 23}]
(* {2022,4,5,2,20,23.} *)

DateList[{2022, 4, 4, 45, 20, 23}]
(* {2022,4,5,21,20,23.} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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