[AccessD] convert text into date

Jim DeMarco Jdemarco at hshhp.org
Fri Apr 25 08:27:37 CDT 2003


The Format function returns a string so if you're stoing the value in a date field be careful.  If you want to return a date value use DateSerial (watch for wrapping):

  dtMyDate = DateSerial(Left(MyTextDate,4), Mid(MyTextDate,5,2), Right(MyTextDate,2))

HTH,

Jim DeMarco
Director of Product Development
HealthSource/Hudson Health Plan


-----Original Message-----
From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net]
Sent: Saturday, April 19, 2003 2:50 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] convert text into date


Pedro,

You could try something like this :

  MyDateField = Format(Right(MyTextDate,2) & "/" & Mid(MyTextDate,5,2) & "/" & Left(MyTextDate,4), "DD/MM/YYYY")

Watch out for line wrapping....

Paul


From: "Pedro Janssen" <pedro at plex.nl>
Date: Sat 19/Apr/2003 18:32 GMT
To: <AccessD at databaseadvisors.com>
Subject: [AccessD] convert text into date

Hello Group,

how can i convert a text field (20001201) into a date field (01-12-2000)

TIA 

Pedro Janssen

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


__________________________________________________________________________
Join Freeserve http://www.freeserve.com/time/

Winner of the 2003 Internet Service Providers' Association awards for Best Unmetered ISP and Best Consumer Application.


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


***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************



More information about the AccessD mailing list