Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Change birthdate format

Posted on 2003-10-24
9
Medium Priority
?
1,497 Views
Last Modified: 2008-03-17
I have a birthday field formatted as mm\dd\yyyy and I need to format it as ccyymmdd.  For example the existing date is 11/24/1929 and I need to change it to 19291124.  
0
Comment
Question by:Peppermint
9 Comments
 
LVL 4

Expert Comment

by:Ashen_Shugar
ID: 9613030

Simply change the format of the field in design view to yyyymmdd, this will retain all your current data but display it in the format you want.

To do this select the Table and go into design view, Select the date field and look at the properties below. The top one is format, change it the text above.



Stephen
0
 
LVL 2

Author Comment

by:Peppermint
ID: 9613059
I actually need to change the date and not just how it appears.  How do I do that?  Thanks
0
 
LVL 4

Expert Comment

by:Ashen_Shugar
ID: 9613110


Dates in Access are actually numbers that count the number of elapsed days since 30/12/1899.

For example the 01/01/2003 is actually 37622 as far as Access is concerned.

So you can only change how the date looks in tables and forms, using the Format.

This is OK though, because any calculations or work you do on the date field use the format information to see how it is displayed.

If you asked for the last two digits of 01/02/2003 when it is formated as yyyymmdd you would get 01 because Access knows the field looks like 20030201 to the user.

Is it any clearer now, if not let us know.





Stephen


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:peter57r
ID: 9613114
Stephen's answer is all you need and can have.

Access does not store dates in any format, just as numbers.  YOU have to apply the format for display.

Pete
0
 
LVL 6

Expert Comment

by:DoppyNL
ID: 9613121
>> For example the existing date is 11/24/1929 and I need to change it to 19291124

This is changing the format, not changing the date.

changing the format yyyymmdd will result in the display you want.

I think you have to be a little more specific on what you want, as to me the question seems answered, but it is not what you are looking for, so you want something else.
0
 
LVL 2

Author Comment

by:Peppermint
ID: 9613242
The trouble is I need to convert the date for the program.  It's ok if the data type is a number or text but it needs the value needs to be stored as 19291124.  Therefore, I have to take the current value of 11/24/1929 and eliminate the "/" and move the year to the beginning, etc.

I'm not exactly sure the reason behind storing the date in a format except to meet some European standard,  but dunno really. Needless to say, I have to actually change the value.  Hope this helps.

0
 
LVL 11

Accepted Solution

by:
joekendall earned 2000 total points
ID: 9613344
Can you change the value in a query instead of the table?

If you want to change the value, you need a new field to hold the value you want to see and set it to text or number.

UPDATE MyTable
SET NewField = Format(OldDate,"yyyymmdd")

Joe
0
 

Expert Comment

by:AccessMD
ID: 9614300
Peppermint,

Make a table that has all the same fields as the original but with the Birthday field, change it to a text field. Then do an append query from the first table to the second.

In the birthday field put the following code instead of the field name:

NewBirthday: Right([Date],4) & Left([Date],2) & Mid([Date],4,2)

This will convert the original date to the format you want in a text field.

I hope this helps. If you need more info let me know.

MD
0
 
LVL 2

Author Comment

by:Peppermint
ID: 9615470
Thanks again Joe!!!  Please check the new questions, I have an easy one for ya!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question