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

Converting a String

Status
Not open for further replies.

qcman

Technical User
Jul 20, 2004
30
US
I would like to convert a string to a datetime.
 
Show the format of your string. It may be smarter to do so using a SQL Expression, but that depends upon your version of Crystal and the database.

A one line post conveys very little, please take the time to share meaningful technical information.

In general you can use the DATE function, such as:

whileprintingrecords;
stringvar MyDate:= "12/31/2006";
date(MyDate)

or if you have a format Crystal won't implicitly convert, use an array function, such as:

whileprintingrecords;
stringvar Array MyDate:= split("12/31/2006","/");
date(val(MyDate[3]),val(MyDate[1]),val(MyDate[2]))

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top