[AccessD] Text to Date conversion

Gustav Brock Gustav at cactus.dk
Thu Dec 22 13:34:26 CST 2005


Hi Gina

As Mark puts, just split the string but remember to wrap it in #..# to indicate a date value:

  SELECT
    *,
    "#" & Mid([awarddate],3,2) & "/" & Left([awarddate],2) & "/" & Right([awarddate],4) & "#" AS AwDate
  FROM
    tblYourTable;

/gustav

>>> hoopesg at hotmail.com 22-12-2005 17:56 >>>
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





More information about the AccessD mailing list