vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Can someone advise the best way to determine a) the # of days since the first of the month from last month (e.g. from 5/1/07) b) the # of days since the end of last month (e.g. from 5/31/07) Is there are a good way to determine the # of workdays in a month. Thanks, Andrey |
| |||
| > # of days since the first of the month from last month datediff(now(),date(concat(period_add(date_format( now(),'%Y%m'),-1),'01'))) > the # of days since the end of last month (e.g. from 5/31/07) datediff(now(),date_sub(concat(date_format(now(),' %Y-%m-'),'01'),INTERVAL 1 DAY)) PB ----- Andrey Dmitriev wrote: > Can someone advise the best way to determine > a) the # of days since the first of the month from last month (e.g. from > 5/1/07) > b) the # of days since the end of last month (e.g. from 5/31/07) > > Is there are a good way to determine the # of workdays in a month. > > Thanks, > Andrey > > > |
| ||||
| There is also a LAST_DAY() function that returns the last day of the month: http://dev.mysql.com/doc/refman/5.0/...functions.html Peter Brawley wrote: > > # of days since the first of the month from last month > datediff(now(),date(concat(period_add(date_format( now(),'%Y%m'),-1),'01'))) > > > the # of days since the end of last month (e.g. from 5/31/07) > datediff(now(),date_sub(concat(date_format(now(),' %Y-%m-'),'01'),INTERVAL > 1 DAY)) > > PB > > ----- > > Andrey Dmitriev wrote: >> Can someone advise the best way to determine a) the # of days since >> the first of the month from last month (e.g. from 5/1/07) >> b) the # of days since the end of last month (e.g. from 5/31/07) >> >> Is there are a good way to determine the # of workdays in a month. >> >> Thanks, >> Andrey >> >> >> > -- Baron Schwartz http://www.xaprb.com/ |
| Thread Tools | |
| Display Modes | |
|
|