Convert a String (atom date) to Date


/ Published in: Groovy
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import java.util.Date
  2. import java.text.SimpleDateFormat
  3.  
  4. String myDate= '2011-01-20T13:51:24.63Z'
  5.  
  6. Date dtTmp = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss").parse( myDate);
  7.  
  8. println dtTmp.toString()

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.