Skip to content
Advertisement

Extract day of week from date field in PostgreSQL assuming weeks start on Monday

extract a number from 0 to 6, where 0 is Sunday; is there a way to get the day of the week in SQL assuming that weeks start on Monday (so 0 will be Monday)?

Advertisement

Answer

From the manual

So, you just need to subtract 1 from that result:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement