Home > database >  Postgresql database query the current implementation time is how many weeks of the month
Postgresql database query the current implementation time is how many weeks of the month

Time:09-27

Postgresql database query the current implementation time how do is the first week of the month, when use datediff, do not have this function,, beg god teach
How to use date_part or extract function

CodePudding user response:

 select 1 + date_part (' week ', dt) - date_part (' week ', dt - ((date_part (' day ', dt) - 1) | | 'day') : : interval) from (values (now ())) data (dt); 
  • Related