Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. String time = "1351504294";
  2. long t = Long.parseLong(time);
  3. Timestamp ts = new Timestamp(t*1000);
  4.  
  5. Timestamp ts = new Timestamp(t*1000);
  6. String s = ts.toString().split('\.')[0];
  7.  
  8. Timestamp ts = new Timestamp(t*1000);
  9. String s = new SimpleDateFormat("MM/dd/yyyy-mm-dd hh:mm:ss").format(ts);
  10.  
  11. public class Time {
  12.  
  13. public static void main(String[] args){
  14.  
  15. String time = "1351504294";
  16. long t = Long.parseLong(time);
  17. Timestamp ts = new Timestamp(t*1000);
  18.  
  19. String date = new SimpleDateFormat("YYYY-MM-dd hh:mm:ss").format(ts);
  20. System.out.println(date);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement