Forum Discussion
HaedenH
15 years agoOccasional Contributor
Ah ha! Got it!
I had a little bit of outside help, but here is what we've come up with:
This code will set the time to the UTC (also 'GMT') Time Zone, subtract the desired 5 minutes, and format the output as follows:
201102041416 becomes 201102041911
Hope this helps someone in the future.
I had a little bit of outside help, but here is what we've come up with:
${=cal = java.util.Calendar.getInstance();
cal.add(Calendar.MINUTE, -5); //subtract 5 mins
dfUTC = new java.text.SimpleDateFormat("yyyyMMddHHmm");
dfUTC.setTimeZone(java.util.TimeZone.getTimeZone("UTC"));
dfUTC.format(cal.getTime());}
This code will set the time to the UTC (also 'GMT') Time Zone, subtract the desired 5 minutes, and format the output as follows:
201102041416 becomes 201102041911
Hope this helps someone in the future.