I want to add 1 day to read_date column along with time.
below is the sample column data
read_date
-----------------------
01-01-19 01:00:00.000000000 AM
Expected Result
---------------------
02-01-19 01:00:00.000000000 AM
I have tried below but it is adding only day not time.
select read_time, read_time+1
from meter_read_alert
read_date                           read_date+1
------------------------------------------------------
01-01-19 12:00:00.000000000 AM      02-01-19
01-01-19 01:00:00.000000000 AM      02-01-19
                When you use + 1, the timestamp is converted to a date.  That is why you are only seeing the date (the default representation of a date does not include the time component although it is there).
Instead, use interval:
select read_time, read_time + interval '1' day
from meter_read_alert;
PS. I learned something from this. Interesting question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With