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

Date question 1

Status
Not open for further replies.

sclark415

Programmer
Mar 17, 2003
42
US
First of all, I did a search, and didn't find this one. Hopefully it isn't really basic, and I'm missing it.

I have a datetime field 'Jun 22 2204 12:00AM' that I need to convert to 06/22/2004 with no time. This is a string instead of date. Can you help me please?
Thanks in advance!
 
Thanks for the info. When I use this, I receive the following when I added the formula to my report 'Bad Date Format String'. I read in a Crystal 9 book that when this error message comes up to use an if-then-else in my formula. All I want to do is convert the date and add it to the report.
 
The following should work if the format of the string is always starts with "MMM dd yyyy":

stringvar x :=

Select left({table.stringdate},3)
Case "Jan" : "01"
Case "Jun" : "06" //add in cases for each month
default : "00";
;

date(val(mid({table.stringdate},8,4)), val(x), val(mid({table.stringdate},5,2)))

-LB
 
lbass, this was perfect! Thank you SO much for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top