Get the first and last working day date of some month in MySQL -


it similar get first , last date of next month in mysql, want first , last working day date of month in mysql. here, working day means monday ~ friday, or dayofweek(date) >= 2 , <= 6. let's not think holiday.

for example (i chose feb should complicated due leap)

2014-02 -> 2014-02-03 (mon) ~ 2014-02-28 (fri) 2015-02 -> 2015-02-02 (mon) ~ 2015-02-27 (fri) 2016-02 -> 2016-02-01 (mon) ~ 2016-02-29 (mon) 

e.g.:

select min(dt),max(dt) calendar dayofweek (dt) not in(1,7) , dt between '2016-01-01' , '2016-01-31'; 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -