Current Date returns in varying (user's device) format > messed up filename for PDF

I’m not sure if this is a bug, but it messed up an operation generating PDFs with DocsAutomator.

In select cases, the filename I’m generating would not produce a valid PDF filename using DocsAutomator. The failed records created the pdf but it did not append a “.pdf” extension, so they wouldn’t open automatically. It turns out that some of my records had dashes and datestamp with “p.m.” in it failed (the ones underlined in red):

image

I’m going to try and format the datastamp before including it in my filname template:

Created new CurrentDateTime MATH field in fixed format:

Updated filename template:

Dates are formatted based on the user’s device settings. Dates in the US are usually formatted differently from the rest of the world, and other countries have other differences as well. Lots of variables at play.

It’s best to convert dates to a stable number for use cases like this where you are using dates for more than just display purposes.

Year(Date)*10^10
+ Month(Date)*10^8
+ Day(Date)*10^6
+ Hour(Date)*10^4
+ Minute(Date)*10^2
+ Second(Date)
1 Like

Thanks Jeff.

I’m aware of the different global date formats. So I can’t use Glide’s fixed formatting as shown in the screen shot. That will ALSO vary by region?

The date formatting set inside a Date or Math column can vary by region settings. It’s not as “fixed” as you may think. It will display differently based on the user’s device settings, so you don’t exactly have control over that date format other than long, medium, or short and with or without time. Also consider that different devices, such as Android, iOS, Windows, MacOS, Linux, as well as different browsers may render that date slightly differently.

It’s like that so your app can be used globally and will adapt based on a user’s region.

3 Likes