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

Crystal 6 and Dates

Status
Not open for further replies.

edmac2

Technical User
May 11, 2000
24
US
What is a good formula for dates in using to search a report. The one I presently use requires the mm/dd/yyyy. Is there one available that would allow mm/dd/yy. What are some of the ones you experts use, the more selections the better. TIA
 
Ken
I use the date as a parameter field to search a report for records between 2 dates. I just wanted to know how to input the dates so crystal could use them. Presently I use

if {?Start Date} = "" then PrintDate
Else
If NumericText(Left({?Start Date},2)) = True
Then if NumericText(Right(Left({?Start Date},5),2)) = True
Then Date(ToNumber(Right ({?Start Date},4)),ToNumber(Left({?Start Date},2)),ToNumber(Right(Left({?Start Date},5),2)))
Else Date(ToNumber(Right ({?Start Date},4)),ToNumber(Left({?Start Date},2)),ToNumber(Right(Left({?Start Date},4),1)))
Else if NumericText(Right(Left({?Start Date},5),2)) = True
Then Date(ToNumber(Right ({?Start Date},4)),ToNumber(Left({?Start Date},1)),ToNumber(Right(Left({?Start Date},4),2)))
Else Date(ToNumber(Right ({?Start Date},4)),ToNumber(Left({?Start Date},1)),ToNumber(Right(Left({?Start Date},3),1)))

And I was just wondering if there were any other formulas out there that were different, shorter, and any that excepted 01 instead of 2001 for a year.Sorry I was so unclear on the question.
 
Tell me if this is correct:

You have a CHARACTER parameter used for selecting records and a DATE field that it is used against. You want to enter the parameter text value in mm/dd/yy format and need a formula to convert this into a date value so that you can use it in your selection formula.

I have a formula in my "common formulas" area (See the FAQ on common formulas) that will convert a character date into a true date with either 2 or 4 character year. See if this will help.

The problem with a 2 digit year is that you have to assume which century it is in. My formula assumes that anything less than 50 is 2000 and over 50 is 1900. If you enter all 4 digits it just uses what you enter. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Thanks Ken this is exactly what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top