I agree with Thinh. If the output is buggy for values 12 and below, but not buggy for values 13 and above, it looks like the editor is interpreting that value as a month rather than an hour.
I find dates and times really tricky. Tricky to understand, tricky to work with. It helps to keep things simple to stay out of trouble.
Here are a few tips:
– Writing dates –
Avoid writing dates manually. Use a picker instead. If done via import, be weary of the format of the date column in the source.
– Relations –
Anytime you create a relation with a date, convert the date to either a string (template column) or a number (math column). This will avoid issues with different date formats from device to device.
– How to convert a raw date to an integer in YYYYMMDD format with a Math column –
Year(date)*10^4+Month(date)*10^2+Day(date)
– Date vs Date-Time –
In the Date & Time column, the configuration to “date only” or “time only” only affects what is displayed in the layout editor and app. Under the hood in the data editor, both the date and time are stored.
– On or After // On or Before // After // Before in conditions (visibility, filter, if-then-else columns) –
• On or After // On or Before: Date only. Ignores the time (because of ‘on’).
• Before // After: Date and time. Takes the time into account.
– Change the format of a date –
Using the Format Date column directly on raw date values is not recommended, as it often leads to issues. Instead, transform the date-time value into a date only that Glide can interpret:
- Convert the raw date to an integer in YYYYMMDD format using a Math column.
- Create a new date from this integer with a ‘Text to Date’ computed column.
- Use this new date in a ‘Format Date’ computed column.
The initial 2 steps ensure you’re working with an unambiguous date and a date only rather than date and time. ‘Format Date’ then becomes more reliable.
Thank you to @jeff, @Darren_Murphy, @mattbrowning and @Oscar_V88 for their input.