I tried doing that using the following code:
String text = props.get("jcr:created").toString();
long timeStamp = Long.parseLong(text);
//convert seconds to milliseconds
Date date = new Date(timeStamp);
// format of the date
SimpleDateFormat jdf = new SimpleDateFormat("dd MMM yyyy");
String java_date = jdf.format(date);
System.out.println("Created Date: "+java_date);But the problem is jcr:created returns an object which has the following values:
java.util.GregorianCalendar[time=1654598024706,areFieldsSet=true,areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT+05:30",offset=19800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=5,WEEK_OF_YEAR=24,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=3,SECOND=44,MILLISECOND=706,ZONE_OFFSET=19800000,DST_OFFSET=0]
But I only want the timestamp. Is there a way that I can get only the timestamp from jcr:created?