Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: time formula Post Reply Post New Topic
Author Message
fabiola
Newbie
Newbie


Joined: 03 Nov 2010
Online Status: Offline
Posts: 9
Quote fabiola Replybullet Topic: time formula
     Posted: 03 Nov 2010 at 6:38am
Hi
I am using a store procedure for this report it has a from date and to date range but the time defaults to the current time.
 
I would like to create 2 formulas start time and end time.
The start time i would like it to be 12:00:00 AM
The end time 11:59:59 PM
 
Can someone help me out on creating these 2 formulas?
Thanks in advance
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Nov 2010 at 3:18am
are you going to use the formulas just for the parameters, or is the stored proc going to use them?
 
in SQL you can do something as simple as :
for the ending time
DATEADD(ms, -3, DATEADD(d, 1, DATEDIFF(d, 0, @DayIn)))
for the starting time:
DATEADD(dd, DATEDIFF(dd, 0, @InputVal), 0)
 
HTH
IP IP Logged
fabiola
Newbie
Newbie


Joined: 03 Nov 2010
Online Status: Offline
Posts: 9
Quote fabiola Replybullet Posted: 04 Nov 2010 at 3:24am
i was going to uise the formula just for the parameter
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 Nov 2010 at 3:38am
same logic applies, but why?  Or are you just formatting the parameter?
 
You can't modify the parameter before it is passed to SQL, CR passes it directly...So the best place to deal with this is in the stored proc.  You can have the stored proc pass back the modified values, or you can format them in CR for presentation.
 
HTH
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