Crystal Reports 7

I am trying to do weekly reports using the FullLastWeek function. The problem is Crystal Reports doesn't recognised the date variable because it is in the wrong format, the problem is I can't seem to find what format the date is supposed to be in.

1. Do you know what the date format is suppsed to be?

2. If my variable is not in the correct format (which I cannot change now) is there a way in Crystal Reports that I can change the format of the date?

3. If number 3 above cannot be done, is there a work around to find the ranges between 2 dates (if the only date formats I am using is YYYYMMDD and DD/MM/YYYY), which I can report on.

Thanks

Mari
mari_carmenAsked:
Who is Participating?
 
ramaswamy_raviConnect With a Mentor Commented:
Mari,

I have assigned a value in dd/mm/yyyy format to @X. This in your case, is coming from the database or else where.

The Date function requires three things:
Year, month and day in numeric format.

Right({@X}, 4) gives the year in text format
Val(Right({@X}, 4)) gives the year in numeric format.

Mid({@X}, 4, 2) gives the month in text format
Val(Mid({@X}, 4, 2)) gives the month in numeric format

Left({@X}, 2) gives the day in text format
Val(Left({@X}, 2)) gives the day in numeric format

{@X} is assumed to be a string. Should your varibale be not a string use ToText function to convert to text before extracting the values.

Hope this answers your question.

Regards,
Ravi
0
 
ramaswamy_raviCommented:
Mari,

Did you try using the Date functions for example, if you have a varibale @X as "21/10/99" you can create a formula @Y as follows:

Date(Val(Right({@X}, 4)), Val(Mid({@X}, 4, 2)), Val(Left({@X}, 2)))

I hope this is what you want. Please let me know.

Ravi

0
 
mari_carmenAuthor Commented:
Could you just explain a little further in how this formula works.

Thanks

Mari
0
 
mari_carmenAuthor Commented:
Just what i needed, thanks.

Mari
0
All Courses

From novice to tech pro — start learning today.