HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker 7 8761
Look up Dateadd in help
You will use something like DateAdd("m", 1, "31-Jan-95") or DateAdd("m", 1,
"[youdatefieldnam e]")
HTH
David B
John Baker <Ba******@Veriz on.net> wrote in message
news:qg******** *************** *********@4ax.c om... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but
finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and
then next month 03/01/03 and so on. In other words, I want to add one to the month and
reset the date. However, adding a given number of days (say 30) does not work because of
the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
Look at dateadd in the help, as in:
dateadd("m", 1, #1/1/04#)
Tom
John Baker <Ba******@Veriz on.net> wrote in message news:<qg******* *************** **********@4ax. com>... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
Thanks..
I guess it IS as easy as it appears!!!!
Regards
John Baker
John Baker <Ba******@Veriz on.net> wrote: HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
John Baker <Ba******@Veriz on.net> wrote in message news:<qg******* *************** **********@4ax. com>... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
Not simple but here is what you do.
Break the date down using Month, Day and Year functions into (1,1 and
2003 all integers)
Increment the month by one (2,1 and 2003)
Then convert into strings and concatenate them back into a string
inserting the "/" separator as necessary. ("1/01/2003")
Use DateValue function to convert back into a date value. John Baker lo************@ hotmail.com (Brian) wrote in
news:f3******** *************** ***@posting.goo gle.com: John Baker <Ba******@Veriz on.net> wrote in message news:<qg******* *************** **********@4ax. com>... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
Not simple but here is what you do.
Break the date down using Month, Day and Year functions into (1,1 and 2003 all integers) Increment the month by one (2,1 and 2003) Then convert into strings and concatenate them back into a string inserting the "/" separator as necessary. ("1/01/2003") Use DateValue function to convert back into a date value.
Ouch!
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
John Baker <Ba******@Veriz on.net> wrote in message news:<qg******* *************** **********@4ax. com>... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
If memory serves, you should be able to use the DateAdd function and
simply do something like:
dim your_date as date
dim next_date as date
your_date = CDate("1/1/03")
next_date = DateAdd("m", 1, your_date)
Cheers,
Steve Cummings
Lyle Fairfield <Mi************ @Invalid.Com> wrote in message news:<Xn******* ************@13 0.133.1.4>... lo************@ hotmail.com (Brian) wrote in news:f3******** *************** ***@posting.goo gle.com:
John Baker <Ba******@Veriz on.net> wrote in message news:<qg******* *************** **********@4ax. com>... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
Not simple but here is what you do.
Break the date down using Month, Day and Year functions into (1,1 and 2003 all integers) Increment the month by one (2,1 and 2003) Then convert into strings and concatenate them back into a string inserting the "/" separator as necessary. ("1/01/2003") Use DateValue function to convert back into a date value.
Ouch!
Thanks. I found the other responses very educational. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim |
last post by:
I have been using the javascript below on a web page since last August to
show the "Site updated" month
minus a month, which has been very successful, but January is showing a
"undefined 2004" message.
Help much appreciated
Jim
var m=new Array(13);var n=new Date()
|
by: Treetop |
last post by:
I have a script for my church that we use for the weekly events. I
currently have it as week of Feb 1, 2003 at the top, then list Sun -
Sat below the date. I have been asked to put the date next to each
day of the week.
I want to have the Month and Day after the day of the week. My
problem is during transition weeks, from one month to the next, that I
cannot figure out how to have it know to start over with day 1 on the
next month.
|
by: markryde |
last post by:
Hello,
I am trying to add the current date to a file name in python script
like thus:
import os
import sys
import rpm
import time
import datetime
|
by: smcgrath via AccessMonster.com |
last post by:
I have a table listing accounts with a closed date - our Trial balance drops
the account after 7 days but our database keeps the record forever - How do I
calculate the end of month less 7 days so that I can get an actual count of
the accounts that were closed during the month. I believe that the
calculation involves
Between(DateSerial(year(Date() etc but I can't figure it out. Thanks,
--
Message posted via http://www.accessmonster.com
|
by: ganeshpillai |
last post by:
I want to write a progeam that displays date in the following format
(dd/mm/yyyy) 09/06/2007 or 9/6/2007 .
| |
by: parshupooja |
last post by:
Hey,
I have dropdownlist where I am adding 2 values:
DDCycle.Items.Add(new ListItem(DateTime.Now.AddMonths(-1).ToString("MMMM"), DateTime.Now.AddMonths(-1).ToString("M/yy")));
DDCycle.Items.Add(new ListItem(DateTime.Now.ToString("MMMM"), DateTime.Now.ToString("M/yy")));
I want to add below value if next month is about start in 5 or less days :
DDCycle.Items.Add(new ListItem(DateTime.Now.AddMonths(1).ToString("MMMM"),...
|
by: mattgray89 |
last post by:
I am new to Access and trying to wrap my head around VBA. I need to first add 17 months to the field "1stQualLastSat" and to have the output date be at the end of that month. Is this possible? A dumbed down answer is greatly appreciated, thank you all so much.
|
by: ddtpmyra |
last post by:
Im using PHP report and I convert the month date into numbers but when I generate and publish it now displaying like this...
1
10
11
2
3
4
5
6 and so forth. How can I make it happen to sor it by correct ascending orders not sorting the first digits only.
|
by: vertigo262 |
last post by:
this one should be pretty simple. All I want to do is formatdate in this format.
Saturday, September 25, 2010 12:00 am
function getRecordInfo(oLink, iIndex) {
var Subject = GridBulletins.Rows.Cells.Value;
var Bulletin = GridBulletins.Rows.Cells.Value;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |