Convert from UTC to Date object

+1 vote
Hello

In Android, your docs shows an example of  converting Date to UTC timestamp.

How can I convert it back to Date object upon retrieval?

 

Thank you
asked Nov 27, 2014 in App42 Cloud API-BaaS by AndroidFolk (107 points)

1 Answer

+1 vote
 
Best answer

Hello AndroidFolk,

Kindly find the below code snippet to convert the UTC time stamp into date object & let us know if it helps:

String strdate = Util.getUTCFormattedTimestamp();

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

Date date = sdf.parse(strdate);

System.out.println(date);

 

Himanshu Sharma

 

answered Nov 27, 2014 by hs00105 (2,005 points)
selected Nov 27, 2014 by AndroidFolk
Thank you. I was missing the quote beside the letters so I thought there is another method. This is great!
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...