473,772 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Dates to Months Calc on a form

9 New Member
I have a form where I have 2 dates:

06/27/2007
01/28/1996

What I need to get is the difference between the 2 dates in months.

Or in otherwords I am trying to get the age of the 2 dates in months.

Can anyone help me? Its been a while since I did this in on a form in Access 2003 and it might be simple and I am just probably missing something stupid.

Thank you!!!
Jul 5 '07 #1
5 1589
puppydogbuddy
1,923 Recognized Expert Top Contributor
I have a form where I have 2 dates:

06/27/2007
01/28/1996

What I need to get is the difference between the 2 dates in months.

Or in otherwords I am trying to get the age of the 2 dates in months.

Can anyone help me? Its been a while since I did this in on a form in Access 2003 and it might be simple and I am just probably missing something stupid.

Thank you!!!
=DateDiff("m", #06/27/2007#, #01/28/1996#)

or you can refer to the texboxes on the form to make it more dynamic
=DateDiff("m", "#" & [txtDate1] & "#", "#" & [txtDate2] & "#")
Jul 5 '07 #2
wespw1
9 New Member
=DateDiff("m", #06/27/2007#, #01/28/1996#)

or you can refer to the texboxes on the form to make it more dynamic
=DateDiff("m", "#" & [txtDate1] & "#", "#" & [txtDate2] & "#")
Thank you so much puppydogbuddy.

I knew it was something stupid I was missing. Worked like a charm!
Jul 6 '07 #3
NeoPa
32,573 Recognized Expert Moderator MVP
=DateDiff("m", #06/27/2007#, #01/28/1996#)

or you can refer to the texboxes on the form to make it more dynamic
=DateDiff("m", "#" & [txtDate1] & "#", "#" & [txtDate2] & "#")
Excuse me for interfering, but the latter form could more simply be done as :
Expand|Select|Wrap|Line Numbers
  1. =DateDiff("m", [txtDate1], [txtDate2])
Converting to literal strings should work equally well, but isn't necessary.
Jul 6 '07 #4
wespw1
9 New Member
Thank you Neopa for your input. I tried something similiar to what you had and the previous person and it worked great.

Thank you both again! It sometimes helps to get refreshers!
Jul 6 '07 #5
NeoPa
32,573 Recognized Expert Moderator MVP
No problem.
PDB provided the main article. I was just adding a comment to that.
Glad you got sorted anyway :)
Jul 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5390
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
26
4416
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: starttime = Date.parse("Aug 10,2003, 07:07") sdt = new Date(starttime)
7
12813
by: Bambero | last post by:
Hello all Problem like in subject. There is no problem when I want to count days between two dates. Problem is when I want to count years becouse of leap years. For ex. between 2002-11-19 2003-11-19
8
2239
by: netsurfer | last post by:
Hi: Have a question on making the date automatically filled in by what the user enters in by the date at the top. The date entered at the top would most likely be on a Wednesday then I need to have all the prior dates pop in. Example: User enters 2/9/05 in the date field at the top being a Wednesday...I need the dates at the bottom to be filled in automatically, respectively as 2/3/05, 2/4/05, 2/5/05, 2/6/05, 2/7/05, 2/8/05, 2/9/05...
22
4168
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b) { return -1; } else
6
27994
by: carl.barrett | last post by:
Hi, I have a continuous form based on a query ( I will also be creating a report based on the same query). There are 2 fields: Date Obtained and Date Of Expiry I want a further 3 columns to the right of these 2 fields to show the
6
77857
by: Ashish Sheth | last post by:
Hi All, In C#, How can I get the difference between two dates in number of months? I tried to use the Substract method of the DateTime class and it is giving me the difference in TimeSpan,From which I can get the duration in days, hours and so.. but how can I get the difference in months? Please reply ASAP. it's urgent. -- regards, Ashish Sheth
14
1962
by: gorio | last post by:
I have a MySQL/PHP based page with a number of date fields that I would like the user to be able to run a script on to update the fields and then submit them for server processing. All my programming to date has been server side, but I feel this exercise is better done client side, hence my post on this group. However my javascript knowledge is very limited. So far I have something like this, I know it won't work like this but I've...
16
2672
by: nsymiakakis | last post by:
Hi All, First let me start by saying, I absolutely love this site. I have an access database that records are keyed in including a date field. i.e. 3/4/07, 3/20/07, 4/10/07,4/18/07, 5/4/07... and queried using a parameter query that asks for a Start and End date. i.e. 1/1/2007, 5/1/2007. These results are in the form of number Totals for that period. This all works well. Now I have been asked to create a bar graph on a report that will show...
0
9619
marktang
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...
0
9454
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,...
1
10038
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
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...
0
6713
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();...
0
5354
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.