Uday
Uday

Reputation: 21

IF condition with getdate() in sybase

I have a requirement where if

getdate()

returns time between midnight 12 to 2 AM, I should consider Date of previous day. How to frame this in a select query ?

Upvotes: 1

Views: 313

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269973

The simplest method is to subtract two hours from the date and do the comparison. For instance:

where col_date < convert(date, dateadd(hour, -2, getdate()))

Upvotes: 1

Related Questions