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

Date Format Help

Status
Not open for further replies.

excalibur78

IS-IT--Management
Jan 3, 2001
66
US
I have date in the following format I can't seem to change it to a useable format for my report.

1/1/2003 is how the date is now
What I need to do it figure out if the day is single digit then if it is add a 0 so it displayes like:
1/01/2003


Thanks ahead of time for the help.


David
 
Right click on your date field. Pick Format Field... On the Date/Time tab, Click the "Customize" button.

Format away. Mike
If you're not part of the solution, you're part of the precipitate.
 
It's a text field since it contains other text besides the date so I can't do it that way. Forgot to mention that.
 
Pease provide a sample(s) of what the complete field looks like. Mike
If you're not part of the solution, you're part of the precipitate.
 
Here is a formula that check to see if the character 2 places away from the first "/" (also check to see if there are any "/'s") is also an "/". If it is, it add a 0 after the first "/". If there is not a "/" it returns the orinial field. If you have CR9 or you know the field will never violate the 254 character limit, you can delete the line in blue
===========================================================
stringvar check:={@your.field};
stringvar out;


if length(check)+1 <=254 then

if instr(check,&quot;/&quot;)>0 then

(if mid(check,instr(check,&quot;/&quot;)+2,1)=&quot;/&quot; then
out:=left(check,instr(check,&quot;/&quot;))+&quot;0&quot;+ mid(check,instr(check,&quot;/&quot;)+1) else
out:=check);

out
============================================================
Mike
If you're not part of the solution, you're part of the precipitate.
 
Thanks I'll try that. Got side tracked on another issue and haven't gotten back to that report. Appreciate the help. I'll try it monday and let you know how it works.


David
 
Or, you could convert the string field into a date (using DateValue function) and then format the real date using the format menu. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Will Crystal pull the date part only from the rest of his string?

I assumed that's what this meant:
It's a text field since it contains other text besides the date so I can't do it that way. Forgot to mention that.

Mike
If you're not part of the solution, you're part of the precipitate.
 
He would have to extract the date characters. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top