How do I extract a date from a UUID using Java? [closed]
How to convert the UUID to date format 2011-04-22 ? For example, I have UUID like this 118ffe80-466b-11e1-b5a5-5732cf729524. How to convert this to date format? I tried String uuid="118ffe80-466b-11e1-b5a5-5732cf729524"; UUID uid = UUID.fromString(uuid); long ls=convertTime(uid.timeStamp()); // it returns long value public String convertTime(long time){ System.out.println("====="+time); Date date = new Date(time); Format format = new SimpleDateFormat("yyyy/MM/dd"); return format.format(date).toString(); } output I got:4294744/11/02 Same case working fine for perl $uuid='ef802820-46b3-11e2-bf3a