DayOfYear Query returns two days

Avatar

Avatar

Bruno_Cotrim

Avatar

Bruno_Cotrim

Bruno_Cotrim

14-05-2019

Hello guys,


I've a simple query that I've not been able to solve. I'm comparing day of year to day of year to find out someones birthday and it it returning me two days.

The query:

birthday query 1.JPG

Note: the @birthday field is a "Date"

Result (today 05/14):

birthday query result.JPG

Sql Query:

(Extract(DOY FROM E0.tsBirthdate) = Extract(DOY FROM (GetDate()) AT TIME ZONE 'Europe/Lisbon'))

As far as I understand the problem seems to be in the Time Zone but I can't see how to solve it...

Does any one have a suggestion on how to solve this issue?


Kind Regards,

Bruno Cotrim

View Entire Topic

Avatar

Avatar

Bruno_Cotrim

Avatar

Bruno_Cotrim

Bruno_Cotrim

14-05-2019

Hello Pierre


Thank you, that seems to have been exactly the problem. I didn't know the method DayOfYear translated the date to the number of days, good to keep in mind.


Kind regards,

Bruno Cotrim