Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10473

date comparison formula not working

$
0
0

Hi,

 

I'm attempting to compare two date values.

 

Date 1

The first date value is 17/02/2013 12:00:00AM and was obtained as follows:

whileprintingrecords;

shared datevar firstdate := Minimum ({Command.entry_date});

If DayOfWeek(firstdate) = 1 Then

firstdate

Else If DayOfWeek(firstdate) = 2 Then dateadd ("d",-1,firstdate)

Else If DayOfWeek(firstdate) = 3 Then dateadd ("d",-2,firstdate)

Else If DayOfWeek(firstdate) = 4 Then dateadd ("d",-3,firstdate)

Else If DayOfWeek(firstdate) = 5 Then dateadd ("d",-4,firstdate)

Else If DayOfWeek(firstdate) = 6 Then dateadd ("d",-5,firstdate)

Else If DayOfWeek(firstdate) = 7 Then dateadd ("d",-6,firstdate)

 

Date 2

The second date value is 17/02/2013 12:00:00AM and was obtained as follows:

whileprintingrecords;

datevar ppsd := {Command.period_start_date};

If DayOfWeek(ppsd) = 1 Then

ppsd

Else If DayOfWeek(ppsd) = 2 Then dateadd ("d",-1,ppsd)

Else If DayOfWeek(ppsd) = 3 Then dateadd ("d",-2,ppsd)

Else If DayOfWeek(ppsd) = 4 Then dateadd ("d",-3,ppsd)

Else If DayOfWeek(ppsd) = 5 Then dateadd ("d",-4,ppsd)

Else If DayOfWeek(ppsd) = 6 Then dateadd ("d",-5,ppsd)

Else If DayOfWeek(ppsd) = 7 Then dateadd ("d",-6,ppsd)

 

You'll notice that both date values are identical. However, when comparing the results I get a "False". The comparison formula I used is:

whileprintingrecords;

shared datevar firstdate;

datevar ppsd;

firstdate = ppsd;

 

It's evident the comparison between these two values is not taking place in this formula because the result should be True.

Any suggestions are appreciated!

Mark


Viewing all articles
Browse latest Browse all 10473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>