I want to convert the ServerValues.TIMESTAMP into “DD-MM-YYYY HH:MM:SS” format.
public Map<String, Object> toMap() {
Map<String, Object> result = new HashMap<>();
if ( date!= null && !date.isEmpty()) {
result.put(AppConstantClass.EVENT_DATE, date);
}
if (time != null && !time.isEmpty()) {
result.put(AppConstantClass.EVENT_TIME, time);
}
if (userId != null && !userId.isEmpty()) {
result.put(AppConstantClass.EVENT_USED_ID, userId);
}
result.put("timestamp", ServerValue.TIMESTAMP);
return result;
}
I want to convert the ServerValues.TIMESTAMP into “DD-MM-YYYY HH:MM:SS” Format and store it into Firebase Realtime Database.
how can i format the “result.put(“timestamp”, ServerValue.TIMESTAMP);” into “DD-MM-YYYY HH:MM:SS” .
Thanks in advance
New contributor
Aakash Vishwakarma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.