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

Convert String to Date 1

Status
Not open for further replies.

cm1234

Technical User
Oct 18, 2002
41
DK
Hi out there

I am running CR 9.0 and have a issue in getting a
string converted to date format.
The string is made in MS sql and i need it to
be visual in CR as a date.
Hope somebody can help me

Best regards
Cm1234
 
Can you let us know what format the string takes? e.g. dd/mm/yyyy, yyyymmdd or something else?

Thanks


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
Hi AngelB

thanks for your qiuck response
the format of the string is 2006-10-30 09.20.00
and i only need the date from this, not the time

best regards
Cm1234
 
Hi again,

In this case the function 'DateValue' will work fine. Your code will be:

DateValue(StringFieldName)

Hope this helps


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
I should also mention that if it's at all possible that the string could come out in a different format, it would be worth using the IsDate function first to check if the string can indeed be converted. Something like:

Code:
If IsDate(StringFieldName) Then
    DateValue(StringFieldName)
Else
    Some default date


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top