Archived Forum Post

Index of archived forum posts

Question:

Android convert email date to different formatted string?

Nov 13 '15 at 20:31

I am having trouble figuring out the best way to convert an email date to a formatted string. I know I can use email.emailDateStr() to get Sat, 31 Oct 2015 01:03:26 GMT, but that is a long cumbersome representation.

What I would like is to have 10/31/15 01:03 as the end result. I thought I could use SimpleDateFormat like this...

SimpleDateFormat sdf=new SimpleDateFormat(MM/dd/yy HH:mm");
String tmpstr=sdf.format(email.GetDt());

but that doesn't seem to work. I think it might be because GetDt() is returning a CkDateString and SimpleDateFormat is expecting milliseconds from what I have read.

I see that CkDateTime has a variety of GetAs methods but none seem to provide the right data for conversion.

Am I missing something?

Thanks Pete