Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: datepart Post Reply Post New Topic
Author Message
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Topic: datepart
     Posted: 07 Jan 2014 at 3:12am
Probably a silly question, but found in an old report :
fromdate : date(2010,datepart("m",currentdate),01)
todate : date(2011,datepart("m",currentdate)-11,1)

what does the ,01 mean in fromdate
what does the -11,1 mean in todate

thanks
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 07 Jan 2014 at 4:23am
The 01 is part of the date function.  Thus is is for the first day of the month or in this case the first day of the current month. The -11, 1 will go back 11 months to the first day of month which would not make sense unless you notice that the fromdate starts in 2010 and the todate is in 2011.  Seems a bit of odd logic, but it apparently worked for who ever designed the report.
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 07 Jan 2014 at 6:18am
can't see that could have worked in January, that would result in month = -10

well I was just curious, couldn't see the logic of it

thanks
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