Advertisement
Guest User

Untitled

a guest
Dec 28th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. @DatabaseField(columnName="out_date",dataType=DataType.DATE_STRING,format="yyyy-MM-dd HH:mm:ss")
  2. private Date out_date;
  3.  
  4. SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  5. outlet.setOut_date(formater.parse(json.getString("outletDate")));
  6.  
  7. String date = "12/3/2014 12:00:00 AM";
  8. SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy HH:MM:SS a");
  9. Date testDate = null;
  10. try {
  11. testDate = sdf.parse(date);
  12. }catch(Exception ex){
  13. ex.printStackTrace();
  14. }
  15. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  16. String newFormat = formatter.format(testDate);
  17. System.out.println(".....Date..."+newFormat);
  18.  
  19. try {
  20.  
  21. SimpleDateFormat sdf1 = new SimpleDateFormat("dd/mm/yyyy HH:mm:ss");
  22. Date date = sdf1.parse("12/3/2014 12:00:00 AM");
  23. String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
  24. System.out.println(format);
  25.  
  26. }catch(Exception e){
  27. e.printStackTrace();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement