vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, How can i get current month's start day and end day using mysql query. Thanks -- View this message in context: http://www.nabble.com/Current-month%...html#a13991390 Sent from the MySQL - General mailing list archive at Nabble.com. |
| |||
| Solved it SELECT date_format(date_sub(curdate(), interval 0 month), '%Y-%m-01') AS a, date_sub(date_format(curdate(), '%Y-%m-'+LAST_DAY(CURRENT_DATE)), interval 0 day) AS b Thanks mmfarhan wrote: > > Hi, > How can i get current month's start day and end day using mysql query. > > Thanks > -- View this message in context: http://www.nabble.com/Current-month%...html#a13991790 Sent from the MySQL - General mailing list archive at Nabble.com. |
| |||
| this will get you the start day mysql> select DATE_FORMAT(CONCAT(SUBSTR(NOW(),1,8),'01'),'%a'); this will get you the end day mysql> select DATE_FORMAT(LAST_DAY(NOW()),'%a'); Is there a reason why you dont want to use a programming language for this task? M-- ----- Original Message ----- Wrom: WLSZLKBRNVWWCUFPEGAUTFJMVRESKPNKMBIP To: <mysql@lists.mysql.com> Sent: Wednesday, November 28, 2007 7:35 AM Subject: Current month's start day and end day > > Hi, > How can i get current month's start day and end day using mysql query. > > Thanks > -- > View this message in context: http://www.nabble.com/Current-month%...tf4888220.html #a13991390 > Sent from the MySQL - General mailing list archive at Nabble.com. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=mgainty@hotmail.com > > |
| ||||
| Because i am writing a report using iReport (which is a JasperReport's Designer) and I thaught Query is an easy way to get these values. mgainty wrote: > > this will get you the start day > mysql> select DATE_FORMAT(CONCAT(SUBSTR(NOW(),1,8),'01'),'%a'); > > this will get you the end day > mysql> select DATE_FORMAT(LAST_DAY(NOW()),'%a'); > > Is there a reason why you dont want to use a programming language for this > task? > M-- > ----- Original Message ----- > Wrom: WLSZLKBRNVWWCUFPEGAUTFJMVRESKPNKMBIP > To: <mysql@lists.mysql.com> > Sent: Wednesday, November 28, 2007 7:35 AM > Subject: Current month's start day and end day > > >> >> Hi, >> How can i get current month's start day and end day using mysql query. >> >> Thanks >> -- >> View this message in context: > http://www.nabble.com/Current-month%...tf4888220.html > #a13991390 >> Sent from the MySQL - General mailing list archive at Nabble.com. >> >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: http://lists.mysql.com/mysql?unsub=mgainty@hotmail.com >> >> > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=lists@nabble.com > > > -- View this message in context: http://www.nabble.com/Current-month%...html#a13996206 Sent from the MySQL - General mailing list archive at Nabble.com. |
| Thread Tools | |
| Display Modes | |
|
|