I need to get the day of the week of a date in H2 as a number. There is a function DAY_OF_WEEK(date) which returns Sunday as the first day of the week. However, I need Monday to be the first day of the week. Does someone know a function in H2 to accomplish this?
I need it for a "weekday" function in a custom hibernate dialect. The values returned shoud correspond to the values of the java DayOfWeek enum.
In MySQL I solved it like this:
registerFunction("weekday", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "WEEKDAY(?1)+1"));
Now I don't know how to accomplish this with H2. Thanks in advance for any help!