Convert 20080217 into "17-Feb-2008" , (year, month, date convertio

A

ali

I have a table. All dates are listed in "Numeric Value" (ex: 20080315).

I'd like to convert thse numeric-values into a standard yyyy-mmm-dd format.

or just convert them into "month" (mmm) , for example,
03 should be March,
05 should be May and
08 shoud be August


Thanks a lot , dear experts !
 
A

Allen Browne

You can get a real date/time value from that number by typing an expression
like this into the Field row in query design:
DateSerial([f] \ 10000, ([f] Mod 10000) \ 100, [f] Mod 100)
Replace "f" with your field name.

To display the result as just the month in your report, set the Format
property of your text box to:
mmmm
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the formidable Format() function.

In the Debug window (Ctrl-G) you can see that Format() will translate
the numeric representation into a date.

? format(20080215,"####-##-##")
2008-02-15

Using that starting formula you can now get various parts of the date:

The month number:

? month(format(20080215,"####-##-##"))
2

The month name:

? MonthName(month(format(20080215,"####-##-##")))
February

etc., etc....
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBR7rOyoechKqOuFEgEQL2IQCfcGlP0siFf9xdpH/G+y5Rr0aVLwoAnjXD
pfy0WnUNdN+E4CP3LiTDuICV
=BYFl
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top