According to the EXTRACTDATES() documentation, when faced with a text date without a year, EXTRACTDATES() should supply the date with the *current* year. I have text dates in a data set that look like this:
28 JUL 10:00 AM CDT
When use the EXTRACTDATES() function on this field, it consistently (always) returns:
7/28/2022
When I would expect it to return: 7/28/2023. Thoughts?
Solved! Go to Solution.
Your observation on 28th July is correct.
The below mentioned observation is not a solution to your query. But just sharing the results of the testing I did. The results are interesting and in line with the hunch I had. Again I am just sharing the test results. Please feel free to contact AppSheet team if you feel it is a bug. I think the implementation of such edge cases depends on what thought process the developers had. It should of course be in line with majority of use cases.
The results show that if the date /month is less than today's date and month, the year extracted is current year (2023) and for the dates greater than or equal to today's date and month, the year extracted is previous year.
11 August
11 April
12 July
13 July
By the way, I'm currently dealing with this by adding +365 to the end of the expression to get it to display with this year, but this seems like a glitch and I'm concerned that if/when it gets corrected, my expression will then by off by a year.
Your observation on 28th July is correct.
The below mentioned observation is not a solution to your query. But just sharing the results of the testing I did. The results are interesting and in line with the hunch I had. Again I am just sharing the test results. Please feel free to contact AppSheet team if you feel it is a bug. I think the implementation of such edge cases depends on what thought process the developers had. It should of course be in line with majority of use cases.
The results show that if the date /month is less than today's date and month, the year extracted is current year (2023) and for the dates greater than or equal to today's date and month, the year extracted is previous year.
11 August
11 April
12 July
13 July
Thanks for the testing. I can see that, depending on the particular use case/situation, it defaulting to one year or the other might be considered beneficial. So my solution should be fine because these dates will always be in the future in my use case. The documentation states that it always defaults to the *current* year, and makes no mention of the date's relative position to today's date. So perhaps it's the documentation that requires some additional explanation/nuance? @Steve I know you've updated documentation in the past when it was needed...? Thanks!
@Suvrutt_Gurjar Thank you for the ping and for investigating this issue. Just want to run this by the AppSheet dev team before implementing a documentation update to confirm that there are no caveats to what you discovered during testing. Really appreciate your help! Will get the docs updated soon.
User | Count |
---|---|
39 | |
32 | |
30 | |
17 | |
16 |