Convert date to months

  • Thread starter bohon79 via AccessMonster.com
  • Start date
B

bohon79 via AccessMonster.com

I have a database that has multiple dates in it. What I am trying to do is in
one field I have a date and I am want that date to convert to months in
another field. Can anyone help me on this.
 
D

David Cox

are you trying to find months between dates? or convert 4 to April?


Look at format function for ways to display months, datediff function for
months difference..
 
J

JudithJubilee

Try:

Month:Format([Date],"mmmm")
This will give the full month, mmm will give the abbreviation, mm 01, 02 etc
and m 1,2,3 etc.

Judith
 
B

bohon79 via AccessMonster.com

This is what i need it to do:

I in put into field1=03 dec 03, then I want field2 to automaticaly
input=43mths
 
J

John W. Vinson

This is what i need it to do:

I in put into field1=03 dec 03, then I want field2 to automaticaly
input=43mths

because today's date is 43 months after 3 Dec 03?

If so, Field2 should NOT be stored in your table at all; any value you put
into it today will be WRONG next month.

Instead, use a calculation in the Control Source of a form or report textbox:

=DateDiff("m", [Field1], Date())

to calculate the number of months between the value in field1 and today's
date.

John W. Vinson [MVP]
 
T

tina

so you're actually wanting to display the number of months elapsed from the
first date...to *today*? to calculate that value, use the DateDiff()
function as David suggested. read up on the DateDiff() function topic in
Access Help, so you'll understand how it works.

hth
 
B

bohon79 via AccessMonster.com

it worked but how do I get the word mths behind the number
 
J

John W. Vinson

it worked but how do I get the word mths behind the number

Just concatenate a literal text string:

=DateDiff("m", [Field1], Date()) & "mths"



John W. Vinson [MVP]
 
B

bohon79 via AccessMonster.com

never mind found the answer on the word mths thing just came to my mind
 
Top