Mar 23, 2006 #1 qcman Technical User Jul 20, 2004 30 US I would like to convert a string to a datetime.
Mar 23, 2006 #2 synapsevampire Programmer Mar 23, 2002 20,180 US 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 Upvote 0 Downvote
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