I’m trying to understand what I’m doing wrong with this expression (please ignore the #// comment - it’s from something else I was doing):
The evaluation I was expecting is ‘18’.
If I try to extract month I get ‘6’.
I’m trying to understand what I’m doing wrong with this expression (please ignore the #// comment - it’s from something else I was doing):
The evaluation I was expecting is ‘18’.
If I try to extract month I get ‘6’.
day needs to be in quotes in the second expression
getDatePart(myDate, 'day')
You might also be looking for the ‘date’ instead of the ‘day’. The day is the numeric day of the week. The date is the numeric day of the month.
getDatePart(myDate, 'date')
Thank you. I just realised that. ‘Day’ was just testing anyway as I’m trying to get month. If I use date in quotes then indeed I am getting the correct day of the month.
Here’s with quotes trying to extract the month though:
I get the same results without quotes. It appears date
is the only unit requiring quotes (understandably).
Day and Month are 0 based. I’ll add it to the documentation and clarify that getDatePart aligns with JavaScript standards which is useful for calculations and other expressions you might find online and want to use. I can understand how that might not be intuitive at first glance!
The formatDate function is a better choice if you are looking for human friendly formatting though.
Apologies for the confusion!
Ahh, that makes sense!
I’ll get the hang of this one day .
Thanks again for your support.