Add 1Hour to java.sql.timeStamp in gsp or groovy
-
21-12-2019 - |
Question
I convert new Date() to GMT. Now I need to add 1 hour to GMT time. The class is java.sql.timeStamp. How do I add 1 hour to the nowGMT variable in grails. I have magic number plugin installed in my project.
Thanks!
Solution
Have you tried:
import groovy.time.TimeCategory
...
Timestamp plusOne = use( TimeCategory ) { nowGMT + 1.hour }.toTimestamp()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow