|
-
Aug 29th, 2007, 01:22 AM
#1
Thread Starter
Hyperactive Member
[CR 8.5]How convert data format to YYYY only
Hi all,
I have a report contains a field in date format
Example : 21 / 08 / 2007
I would like convert it to "mmm/yyyy"
I use the code in edit formula like this
Code:
MonthName(Month({Table.Date1}),True) & " / " & year({Table.Date1})
However, my return format is : Aug / 2007.00
How can i make it return format = Aug / 2007
Your help is much appreciated. Thanks you
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Aug 29th, 2007, 03:03 AM
#2
Thread Starter
Hyperactive Member
Re: [CR 8.5]How convert data format to YYYY only
i had solved the problem by using mid
But i wondered is it the best solution.
Code:
MonthName(Month({Table.Date1}),True)& " / " & replace(mid(cstr(year({Table.Date1})),1,5),","," ")
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Aug 29th, 2007, 09:41 AM
#3
Re: [CR 8.5]How convert data format to YYYY only
Crystal has a ToText function. The second argument of the function indicates how many decimal places to include.
ToText(Year({Table1.Date}), 0)
-
Aug 29th, 2007, 10:37 AM
#4
New Member
Re: [CR 8.5]How convert data format to YYYY only
The solution that brucevde propsed also works with the Crystal Basic CStr function:
CStr(Year({Table1.Date}), 0)
-
Aug 29th, 2007, 11:49 AM
#5
Re: [CR 8.5]How convert data format to YYYY only
can't you just drop the date field onto the report and change it's format to display MM/YYYY? We do that a lot... esp in our report headers. We'll pass in a date as a parameter, like "8/1/2007", then in the report, drop the parameter onto the report, right-click, format (or it maybe properties), and set the format so that it gives "Aug 2007".
-tg
-
Aug 29th, 2007, 08:37 PM
#6
Thread Starter
Hyperactive Member
Re: [CR 8.5]How convert data format to YYYY only
Thanks svobill and brucedve, u shorted my coding
techgnome u might misunderstood my problem or i didnt make it clearly i need to group it afterward, thanks you a lot....
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|