Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: datepart returns decimals? Post Reply Post New Topic
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: datepart returns decimals?
     Posted: 05 Oct 2012 at 8:37am
Hi the following formula
datepart('m',Minimum({?Review Date}))&'-'& datepart('yyyy',Minimum({?Review Date}))&' thru '&
datepart('m',Maximum({?Review Date}))&'-'& datepart('yyyy',Maximum({?Review Date}))


returns

1.00-2,012.00 thru 10.00-2,012.00

I didn't want decimals or commas

Thanks In Advance
Joe

IP IP Logged
shanth
Groupie
Groupie


Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
Quote shanth Replybullet Posted: 05 Oct 2012 at 9:20am
Try this

totext(DatePart('m',Minimum({?Review Date})),0,"")&'-'& totext(datepart('yyyy',Minimum({?Review Date})),0,"")&' thru '&
totext(datepart('m',Maximum({?Review Date})),0,"")&'-'& totext(datepart('yyyy',Maximum({?Review Date})),0,"")

ELSE TRY THIS
int(datepart("m",{?Review Date}))
and trim decimal part with replace

If it is just a field to display, right click on that field and customize the format.
 
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 11 Oct 2012 at 4:39am
Works great Thanks

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Oct 2012 at 6:40am
as an FYI you could simply your process a little by
 
totext(Minimum({?Review Date}),"M-yyyy") & " thru " & totext(Maximum({?Review Date}),"M-yyyy")
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum