Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Finding the 15th of the Month Post Reply Post New Topic
Author Message
jennifer_falcon
Newbie
Newbie
Avatar

Joined: 15 Jan 2009
Online Status: Offline
Posts: 35
Quote jennifer_falcon Replybullet Topic: Finding the 15th of the Month
     Posted: 31 May 2010 at 7:37am
Good Day,

I have a report based on the Close Time of a ticket. I need to report on all tickets where the close time is between the 15th of the previous month and the 15th of the current month.

For example, I would like to see all the closed tickets between January 15th, 2010 00:00:00 and February 15th, 2010 23:59:59

or February 15, 2010 00:00:00 and March 15th, 2010 23:59:59.

My close time is stored as dd/mm/yy hh:mm:ss

Thanks!


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Jun 2010 at 3:42am
local datetimevar startDate ;
local datetimevar endDate := DateTime(Year(now), Month(now),15,23,59,59);
 
if month(now) = 1 then
  startDate := DateValue(Year(now) -1, 12, 15);
else
  startDate := DateValue(Year(now), Month(now)-1,15);
 
 
should work in a record filter....if you need the variables in more than 1 location in the report, make the declaration shared or global instead of local, then you can create a formula that references them like:
shared datetimevar endDate;
....
endDate
 
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