Yes, that looks reasonable. Of course, if that's what you want to do (now+1 hour), you could also do it in Java:
Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR_OF_DAY, 1); Timestamp t = new Timestamp(cal.getTimeInMillis()); Cheers Lukas 2012/4/2 Ian Clarke <[email protected]> > Ah, quick question. I could be misinterpreting, but this appears to be > adding 1 hour to the current value of the NEXT_POLL_AFTER field, but > actually I'd like to set it to an hour after the current timestamp. Am I > correct in assuming this is how to do this: > https://gist.github.com/25672655213bee12bb8c > > Thanks again! > > Ian. > > On Sunday, April 1, 2012 1:54:10 AM UTC-5, Lukas Eder wrote: > >> Hello Ian, >> >> I'm about to standardise date/time arithmetic for jOOQ 2.2.0. This >> area is quite complex, as hardly any database follows the SQL standard >> for date/time intervals. In the mean time, I suggest you use >> MySQL-specific date/time functions, as specified here: >> http://dev.mysql.com/doc/**refman/5.6/en/date-and-time-** >> functions.html#function_date-**add<http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_date-add> >> >> i.e. >> create >> .update(RSS_DESTINATION_**SOURCES) >> .set(NEXT_POLL_AFTER, >> // Create a plain SQL function for adding dates >> function("date_add", Timestamp.class, NEXT_POLL_AFTER, >> // Add a MySQL-specific interval literal to your date >> literal("interval 1 hour"))); >> >> Cheers >> Lukas >> >> 2012/3/31 Ian Clarke <[email protected]>: >> > A quick question: >> > >> > How would I update a field (a MySql timestamp) to the current time plus >> 1 >> > hour? >> > >> > ie. >> > >> > create.update(Tables.RSS_**DESTINATION_SOURCES) >> > .set(RssDestinationSources.**NEXT_POLL_AFTER, ??? ) >> > >> > Thanks, >> > >> > Ian. >> > >> > -- >> > Ian Clarke >> > Blog: http://blog.locut.us/ >> > >> >>
