Datetime ISO Values Are All The Same

Hello,

I need a ISO DateTime for a single day only, e.g., May 4, 2024. When I select a single day, all of teh “time” values are the same like below (basically all are 12am):

2024-05-04T00:00:00Z	
2024-05-04T00:00:00Z	
2024-05-04T00:00:00Z	
2024-05-04T00:00:00Z

If I change the timeframe to two days or more, the times correctly populate randomly. What can I do to fix this?

Note: in this answer, I’m assuming when you say “select a single day”, you mean your min and max dates are the same date. If that’s untrue, please specify what dates you are using.

Ranges like that go from min to max. I’m assuming - because I’m not the author, and I don’t see anything in the help - that the datetimes go from a mindate.midnight to a 1 second before maxdate.midnight. So, if you set both dates to the same value, you saying you want a time between midnight today and one second before midnight today. That’s only going to get you midnight today.

I tried setting the min to today and the max to tomorrow, and all the generated dates were today with appropriately random times. Is there a reason that won’t work for you? Are you getting different values?

Your reply makes sense on why the times are all the same; I think the expectation is if I need to populate data for a single calendar day, the data is spread out across that day. I used the custom code below to fake the date in ISO format:

'2024-05-04T' + pad(random(0,23), 2, '0', 'left') + ':' + pad(random(1,58), 2, '0', 'left') + ':' + pad(random(1,58), 2, '0', 'left') + 'Z'

and that spit out the following:

2024-05-04T06:37:26Z
2024-05-04T12:29:45Z
2024-05-04T06:15:35Z

I am curious about something. If I set up a field like this, where the min date is today and the max date is tomorrow, all my dates are today from midnight to 1 second before midnight; IOW, it’s a single calendar day with times spread across the entire day.

Date
2024-05-13T13:35:03Z
2024-05-13T04:44:33Z
2024-05-13T01:06:58Z
2024-05-13T16:57:08Z

I am curious on why this won’t work for you? Obviously, what you have works, but it seems you’re fighting against the tool a little in this instance.

2nd question: In your formula, is there are particular reason you go from 1 to 58 for minutes and seconds and not 0 - 59?

Seems my understanding of how the system should work is a bit different than how it actually does. If the business objective is to get values from a single day, my expectation was to select the start and end dates as the same.

The reality is, I need to select the start and end dates in a manner that it spans two days - like in your example. While I understand technically why this is the case, sans a Help File notation on the topic this is fairly unintuitive - for the same reason if I wanted only two days (say the weekend), I’d actually need to select Friday through Monday (3 calendar days). A note or example in the FAQ might help folks newer to Mackaroo.

As for the “58”, typo on my part.

1 Like