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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date format -- another question 1

Status
Not open for further replies.

deadfish

Programmer
Nov 13, 2002
50
HK
Hi,
Suppose I have a string which I know it is a string containing a date with dd/mm/yyyy format.

How to convert it to a datetime? (CDateTime seems doesn't work in some case when the string is "01/02/2004", it will read as "02 Jan 2004" if the date format is set to mm/dd/yyyy in Regional Options in Windows)

Thanks in advance!

 
NAME : {@ConvertToDateTime}

FORMULA : DateTime ((ToNumber (Right ({DateString_txt.dd/mm/yyyy},4))),
(ToNumber (Mid ({DateString_txt.dd/mm/yyyy},4 ,2 ))),
(ToNumber (Left ({DateString_txt.dd/mm/yyyy},2))),
0, 0 ,0 )

- - - - - - - - - - - - - - -

Replace the {DateString_txt.dd/mm/yyyy} with your {Table.Field}.
 

Thanks MJRRBIM..it work while i have same problem with deadfish. how about if i want get month only. it that same formula or another.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top