Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Range formula Post Reply Post New Topic
Author Message
punamgandi
Newbie
Newbie
Avatar

Joined: 28 Dec 2011
Location: India
Online Status: Offline
Posts: 3
Quote punamgandi Replybullet Topic: Date Range formula
     Posted: 29 Dec 2011 at 7:46pm
hello everyone,
I want to get first day of week and

i applied this formula for getting date range

if DayOfWeek ({@DATE})=2 then
{@DATE}
else if DayOfWeek ({@DATE})=3 then
{@DATE}-1
else if DayOfWeek ({@DATE})=4 then
{@DATE}-2
else if DayOfWeek ({@DATE})=5 then
{@DATE}-3
elseĀ  If DayOfWeek ({@DATE})=6 Then
{@DATE}-4
else If DayOfWeek ({@DATE})=7 Then
{@DATE}-5

//DayOfWeek ({@DATE})

But when the month changes this formula doesnt work..

can anyone tell me what should be the formula even when the month changes?


Punam Gandi
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 30 Dec 2011 at 3:25am
how about:
dateadd("d", -dayofweek({@date}) + 2, {@date})
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