[AccessD] Text to Date conversion

DWUTKA at marlow.com DWUTKA at marlow.com
Thu Dec 22 11:01:43 CST 2005


DateSerial goes Year, Month, Day.

So with 05102005 you would want:
DateSerial(val(right(awarddate,4)),val(left(awarddate,2)),val(mid(awarddate,
3,2)))

Drew

-----Original Message-----
From: Gina Hoopes [mailto:hoopesg at hotmail.com]
Sent: Thursday, December 22, 2005 10:57 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Text to Date conversion


Merry Christmas, everyone.

I feel like I'm losing my marbles because I can't figure out what's going 
wrong in my query. I've got a table that I imported from Excel with the 
dates in European format and stored as text. I'm trying to convert the text 
to a U.S. date with the following function. AwardDate in this example = 
"05102005"

Format(DateSerial(Mid([awarddate],3,2),Left([awarddate],2),Right([awarddate]
,4)),"mm/dd/yyyy")

The result comes out not as 10/05/2005 but as 10/26/2015.

I put the Format function in to try and fix it but it's the same with or 
without Format. There must be something I'm just not seeing. Can someone 
give me a boost here?

Thanks!!
Gina


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list