Skip to main content

Can anybody help with SQL Query to pull date 1 day greater than current date apart from the standard condition ie CHKOUT_DT  = DATEADD(dd,1,GETDATE()) which seems not be working properly

 

#Sql Queries #SQL

답변 1개
  1. 2024년 1월 5일 오전 10:28

    Hi, @Anirudh venugopal

    The function GetDate() displays the time up to seconds, so it is necessary to use conversion functions like Convert to eliminate the display of hours, minutes, and seconds.

     

    Additionally, GetDate() is presented in the CST (Central Standard Time) timezone. Therefore, instead of simply adding one day, you should add the time corresponding to your timezone. In my country, Japan, we use JST (Japan Standard Time), and there is a 15-hour difference with CST. So, to represent one day later, you should add 15 hours to 24 hours. (= 39 hours.)

     

    Please adjust the logic according to your country's timezone:

    CHKOUT_DT = Convert(Date,DateAdd(hh,39,GetDate()),111)

0/9000