10-28-2011 08:44 PM - last edited on 10-28-2011 08:57 PM
Hi Simon. AnswerDateTime is stored as a long. I've tried the following code but is does not work. Unhandles class exception.
Date date = (Date)settingsTable.get("AnswerDateTime");
//Long date = (Long)settingsTable.get("AnswerDateTime"); //still generates exception
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Dialog.inform(sdf.format(date));
Any thoughts on what I am missing? Appreciate the support. Thanks much.
Some debugging shows that sdf.format(date) is returning --/--/----
I can see the long value is 1319847922225 but cant get it to the sdf format.
10-28-2011 09:14 PM
I've found that it seems to work fine if I use...
answerDateTime = (Long)settingsTable.get("AnswerDateTime");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
long thedate = Long.parseLong(answerDateTime.toString());
Dialog.inform(sdf.formatLocal(thedate));
Is this the ideal solution?