question

GayatriPanigrahi avatar image
GayatriPanigrahi asked

Consider 2Days Date as Single Day

Hi,

Could you please help me to build below logic.

If date between '2018-05-28 06:00:01' and '2018-05-29 06:00:00' then need to show as 2018-05-29

If date between '2018-05-29 06:00:01' and '2018-05-30 06:00:00' then need to show as 2018-05-30

So whenever user see transaction details done on 2018-05-29 the data should consist of date between '2018-05-28 06:00:01' and '2018-05-29 06:00:00' .

sqlt-sqltsql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Kev Riley avatar image
Kev Riley answered

Add 18 hours to every date, that way it will shift the date into the correct date - whether you do that in your query or as a computed column will depend on the complexity of your application and your requirements.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.