Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting text to date

Status
Not open for further replies.

nemmeh

Technical User
Jul 7, 2003
30
US
Hello everyone,

I need some guidance please.

I have a table [Voters] that has a DateofBirth field, well the field is not in date/time format. Instead the data type for the field is "number" with a field size of long integer.

However, the dates aren't in a floating point form. An example of what I have is "7121980" or "12301973" with it being mmddyyyy.

If possible, could someone advise me on converting these numbers into a date format? I would like it mm/dd/yyyy format.

Also, is there any way to insert a leading 0 for the records that don't have a 8 digit date. For instance, with my first example of "7121980" how could I make a query that adds a leading 0 to any dates that only contain 7 digits? So the result would be "07121980".

I'm sure all that is needed in this case, is probably to convert the field from "number" to "text" then do some time of insert, where it inserts the / in the proper place so many digits from the left or right.

I'm just a little lost on the syntax needed to accomplish this.

If anyone can help me with this, I'd surely appreciate it. Thank you.
 
nevermind, i got it figured out.

Just used dateserial(year,month,day) function.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top