There is also a LAST_DAY() function that returns the last day of the month:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-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/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to