SOLUTION: DAY and DATEONLY functions ignoring locale information
Users have been running into problems with the DAY function returning the wrong day and DATEONLY returning the wrong date. The reason is that these functions do not reference the user's locale information, and resolve against UTC time instead. That's fine if you live in the same timezone as Britain, but a tragedy if you live elsewhere on the globe.
This solution is based on converting the DAY component into text first and then manipulating it.
To simulate the DAY function, use the following:
= VALUE( LEFT( [Created Date]@row + "", 2 ) )
To simulate the DATEONLY function use something like:
= DATE( YEAR( [Created Date]@row), MONTH( [Created Date]@row ), VALUE( LEFT( [Created Date]@row + "", 2) ) )
This workaround will also work with other failing functions like WEEKDAY, WORKDAY, and so on
Comments
-
UPDATE:
My locale uses the date format DD/MM/YYYY, so the solution above needs to be modified to work in other locales. Here's an example for the USA which has been updated with extra robustness around change of month and change of year:
= VALUE( MID( [Created Date]@row + "", 4,2 ) )
To simulate the DATEONLY function use something like:
= DATE( VALUE( RIGHT( [Created Date]@row + "", 4 ) , VALUE( LEFT( [Created Date]@row + "", 2 ) , VALUE( MID( [Created Date]@row + "", 4, 2 ) ) )
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 413 Global Discussions
- 221 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 461 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives