Date Comparison Confusion

(imported topic written by arpotu91)

Hello,

I’m trying to compare two dates recast as strings, and I’m getting unexpected results.

Here’s the truncated “current date”:

q: following text of first " " of (current date as string)

A: 04 Jun 2009

T: 0.048 ms

I: singular substring

… and the date I want to compare against:

q: "01 " & current month as string & " " & (current year as string)

A: 01 June 2009

T: 0.080 ms

I: singular string

But, when I compare the two (notice I changed the "01 " to "04 "), they don’t match:

q: if (following text of first " " of (current date as string) = ("04 " & current month as string & " " & current year as string)) then (TRUE) else (FALSE)

A: False

T: 0.105 ms

I: singular boolean

I would expect that boolean to evaluate to TRUE, since the strings match.

Ideas? Do I need to recast the substring as a string (which would be odd)?

Thanks,

Arpotu.

(imported comment written by sthull)

Hi Arpotu,

I’ll admit I didn’t catch it right away either, but your strings actually do not match. The first date has the string “Jun” but the second date has the string “June”. It would probably be easier to compare the dates natively, as opposed to converting them to strings:

q: current date = 4 as day_of_month & current month & current year

A: True

T: 0.064 ms

I: singular boolean

Regards,

Steve

(imported comment written by arpotu91)

Dang - infinitely more easy. Thanks, works great!

Arpotu.