Not sure this is a bug of not, but it seems buggy to me.
When you use:
It returns 5
According to Ignition Help Documentation dateFormat returns (1 = Monday, …, 7 = Sunday) so according to Help the above expression is correct
When you use:
It returns 6
There is no information in the Help Documentation on what the ‘dateExtract’ expression with ‘dayofweek’
I could see the dateExtract above returning a 4 that would mean that it would be returning (0 = Monday, …, 6 = Sunday) as it is now it is returning (1 = Sunday, …, 7 = Saturday) Is this how it is supposed to work??
Thanks in advance!
Huh. I think the issue is in the underlying Java.
If I recall, some Java libraries. (like util.Calendar, I think) use Sunday=1, while others (util.date, maybe?) uses the ISO standard of Monday=1.
[quote]Huh. I think the issue is in the underlying Java.
If I recall, some Java libraries. (like util.Calendar, I think) use Sunday=1, while others (util.date, maybe?) uses the ISO standard of Monday=1.[/quote]
It’s not even that simple – it can also depend on when the first day of the week is for your locale, and even the Java documentation is lacking details on what methods change with locale. (But I’ve made a note to improve ours, which will help.)
The dateFormat expression relies on Java’s SimpleDateFormat.format() function, while dateExtract relies on Java’s Calendar.get(timeUnit) function. From the code, it definitely looks like any differences in the return value are due to Java.
Better Clarification in the documentation would help greatly!
I thought 4 was actually 6 for a while.