Timestamp for the previous day

Database
Enthusiast

Timestamp for the previous day

Hi All,

I have a requirement which goes like this:

My timestamp(6) field, which is, say, myTimeValue contains: 2014-10-08 10:14:51.210000

Now, if I wanted to change this to the previous days value, still retaining the hour, minute, second and millisecond values as it is, how would I do that? What I mean is, if I had to get 2014-10-07 10:14:51.210000 from 2014-10-08 10:14:51.210000, how can that be done in an efficient way?

Please help!

Thanks,

Shardul

2 REPLIES
Enthusiast

Re: Timestamp for the previous day

select myTimeValue -interval '1' day from your_table;

Enthusiast

Re: Timestamp for the previous day

Thanks Raja :)

Silly me.

Thanks again

-Shardul