9
$\begingroup$

Is there a way to convert the DateObject whose FullForm is:

date1 = DateObject[List[2019,9,14,0,0,0],"Instant","Gregorian",-7.`]

into the following DateObject:

date2 = DateObject[List[2019,9,14],"Day","Gregorian",-7.`]

My list has DateObjects with "Instant" granularity, but I need to use Cases to pick out elements from the same day. I seem to have missed in the documentation how to do this... Thanks for any advice.

$\endgroup$
0

1 Answer 1

12
$\begingroup$

DateObject itself can be used for this:

date1 // FullForm

DateObject[List[2019,9,14,0,0,0],"Instant","Gregorian",-7.`]

DateObject[date1, "Day"] // FullForm

DateObject[List[2019,9,14],"Day","Gregorian",-7.`]

$\endgroup$

Your Answer

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

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