I’m looking to do a mass query update on a column that is in ms from the epoch. For each row returned according to my where clause, I would like to update the time value to something passed in, and have it still stored in ms. What would my update clause need to look like?
For example, I have two rows
MY_TIMESTAMP | VALUE
----------------------
1281275302000 | some val 1
1347198502000 | some val 2
Row 1 corresponds to Sun, 08 Aug 2010 13:48:22 UTC
Row 2 corresponds to Sun, 09 Sep 2012 13:48:22 UTC
Now I want to set both times, say to 07:00:00, but leave the dates as is. So the result of the update statement should look like:
MY_TIMESTAMP | VALUE
----------------------
1281250800000 | some val 1
1347174000000 | some val 2
corresponding to Sun, 08 Aug 2010 07:00:00 UTC and Sun, 09 Sep 2012 07:00:00 UTC
It should be possible with only simple math, to avoid any time zone consideration:
MY_TIMESTAMP - (MY_TIMESTAMP % 86400000)gives you the date without the time25200000equals 7 hours in milliseconds.