{"id":34,"date":"2009-04-06T18:12:55","date_gmt":"2009-04-06T12:42:55","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=34"},"modified":"2016-12-19T15:28:29","modified_gmt":"2016-12-19T09:58:29","slug":"groovy-finding-futureprevious-dates","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/groovy-finding-futureprevious-dates\/","title":{"rendered":"Groovy Finding Past\/Future Dates"},"content":{"rendered":"<p>Often I found it painful working on dates when I had to find a past\/future date based on weeks, months or years.<\/p>\n<p>Groovy class org.codehaus.groovy.runtime.TimeCategory has very helpful &amp; intutive syntax for working on dates.<br \/>\nI am sure I need not to explain what each of the following statements will do:<\/p>\n<pre lang=\"groovy\">Date date = new Date()\r\n\r\nuse(org.codehaus.groovy.runtime.TimeCategory) {\r\n    date = date - 10.seconds\r\n    date = date - 10.minutes\r\n    date = date - 10.hours\r\n    date = date - 10.days\r\n    date = date - 10.weeks\r\n    date = date - 10.months\r\n    date = date - 10.years\r\n}<\/pre>\n<p>\u2013<br \/>\n~Aman Aggarwal<br \/>\naman@intelligrape.com<\/p>\n<p><a href=\"http:\/\/www.tothenew.com\/blog\/\">http:\/\/www.IntelliGrape.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often I found it painful working on dates when I had to find a past\/future date based on weeks, months or years. Groovy class org.codehaus.groovy.runtime.TimeCategory has very helpful &amp; intutive syntax for working on dates. I am sure I need not to explain what each of the following statements will do: Date date = new [&hellip;]<\/p>\n","protected":false},"author":282,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2},"categories":[7],"tags":[4840,9,59],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/282"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}