473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Current Month

How do you get the current month - 1 month?

(so not a particular day, but the whole month)

Thanks,

Gary
Jul 23 '05 #1
4 15808
Gary wrote:
How do you get the current month - 1 month?

(so not a particular day, but the whole month)


Functions you need:
CURDATE()
SUBDATE()
MONTH()

Manual where you can learn how to use them:
http://dev.mysql.com/doc/mysql/en/da...functions.html
Jul 23 '05 #2
Gary wrote:
How do you get the current month - 1 month?

(so not a particular day, but the whole month)


SELECT MONTH(SUBDATE(N OW(), INTERVAL 1 MONTH))

The date and time functions can be found in the manual here:
http://dev.mysql.com/doc/mysql/en/da...functions.html

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 23 '05 #3
Great, thanks, follow-up question, how can it apply to a column which isn't
called month? i.e. I want to view the records in column A where the month is
month-1
"Chris Hope" <bl*******@elec trictoolbox.com > wrote in message
news:d8******** **@lust.ihug.co .nz...
Gary wrote:
How do you get the current month - 1 month?

(so not a particular day, but the whole month)


SELECT MONTH(SUBDATE(N OW(), INTERVAL 1 MONTH))

The date and time functions can be found in the manual here:
http://dev.mysql.com/doc/mysql/en/da...functions.html

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

Jul 23 '05 #4
Never mind, the link below answered it, thanks for your help!
"Gary" <ga**@aviatorwe bsite.com> wrote in message
news:%g******** ************@to rnado.tampabay. rr.com...
Great, thanks, follow-up question, how can it apply to a column which
isn't called month? i.e. I want to view the records in column A where the
month is month-1
"Chris Hope" <bl*******@elec trictoolbox.com > wrote in message
news:d8******** **@lust.ihug.co .nz...
Gary wrote:
How do you get the current month - 1 month?

(so not a particular day, but the whole month)


SELECT MONTH(SUBDATE(N OW(), INTERVAL 1 MONTH))

The date and time functions can be found in the manual here:
http://dev.mysql.com/doc/mysql/en/da...functions.html

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com


Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1887
by: Ben | last post by:
Hi I am currently building a database in Access 97 and have a (quite easy) question. I want to produce a query / report that will bring out all the people in the database that have a birthday in the current month / next month. The idea would be so that just before the beginning of a new month, the user can click a button that will give a...
4
6682
by: Jason Chan | last post by:
How can I get the month and year a calendar control current displaying? My problem is I want to load a list of event to a calendar so that it display difference style if there a event for a day. My initial idea is load all events from database and store it in a DataTable. In the DayRender event, loop thr the DataTable and see if it equal...
6
26300
by: vijayk | last post by:
Hi all, I have a field which has data as YYYYMMDD, and I have to find the age of the person by substracting it from current date. can you please please advice... thanks
14
3477
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity. However, the expectation changes - it may be 60% for a while, then change to 50%. Initially, I was averaging the expectation, along with the...
5
2942
by: RandyG | last post by:
how do you pull the current months data without having to manually input the date each time?
3
2736
by: JC21 | last post by:
Hello all, I have a question on MS calendar. On one of my forms in my DB I have the MS calendar. My question is how do I set the calendar so that the current month is always displayed. Currently when ever I open the form the month of December is the default month. I always have to go into the design and change it to the current month. Is there...
5
10398
by: soni2926 | last post by:
Hi, I have a web application, asp.net and c# done in 2.0, which is going to return rows from the db with dates or certain events. The db is going to have events dates for the entire year, but on the site we just want those events for the current month. Is there a way to check this, check as each date is returned if it falls under the...
5
3220
by: bruce24444 | last post by:
I have a database which assigns warranty claims to people with a main screen showing number of files assigned to each person. The number assigned shows day, week, month and year numbers so they can be evenly distributed. The problem I'm having is getting the query to return a number of files for the current date. Week, month and year appear...
1
1900
jamesd0142
by: jamesd0142 | last post by:
New here, need to store the current month in a variable? How can this be done? -------------------------------------------------------------------- Or if anyone can... i want to get the current month and store in a varibale. So i want @Month = current month ???
6
27138
by: abhishekbrave | last post by:
i have created following drop down box for displaying year... i want to populate the drop down box upto current year.. and need to write a java script for this .. any pointers in this regard will be very helpful <select name=year> <option value=2008>2008</option> <option value=2007>2007</option> <option value=2006>2006</option> </select>
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.