Skip to content

Instantly share code, notes, and snippets.

@anataliocs
Created October 23, 2013 19:03
Show Gist options
  • Save anataliocs/7124611 to your computer and use it in GitHub Desktop.
Save anataliocs/7124611 to your computer and use it in GitHub Desktop.
Java dates date conversion
calendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST5EDT"));
String birthDate = (String)report.get("birthDateDay") + " " + (String)report.get("birthDateMonth") + " " + (String)report.get("birthDateYear");
SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy");
ageVal = new Date().getTime() - sdf.parse(birthDate).getTime();
ageVal /= 31536000000l; // covert milliseconds to years
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST5EDT"));
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
sdf.setCalendar(cal);
cal.setTime(date);
AND CONVERT(char(10), Dateadd(second, (req.orderforStamp/1000), '01/01/1970'), 101) between Dateadd(m,-24,GETDATE()) AND GETDATE()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment