json - Can't parse Date with DateTimeFormat -
i can't string parsed datetimeformat format. here input string : thu apr 07 00:00:00 edt 2011
and format:
datetimeformat.getformat("eee mmm dd hh:mm:ss vvv yyyy");
i've read correct format string, me it's not parsing correctly. here code:
public class ycdatecolumn extends textcolumn<jsonobject> { datetimeformat fmtc = datetimeformat.getformat("dd-mmm-yyyy"); datetimeformat fmtb = datetimeformat.getformat("mmm dd, yyyy hh:mm:ss a"); datetimeformat fmta = datetimeformat.getformat("eee mmm dd hh:mm:ss vvv yyyy"); private string key = null; private string def = null; public ycdatecolumn(string akey, string adefault) { super(); key = akey; def = adefault; } public ycdatecolumn(string akey) { this(akey, null); } @override public string getvalue(jsonobject aobj) { system.out.println("ycdatecolumn - object= " + aobj); jsonvalue mval = aobj.get(key); if (mval == null) return def; system.out.println("ycdatecolumn - parse string: " + mval.isstring().stringvalue()); return fmtc.format(fmta.parse(mval.isstring().stringvalue())); } } the last system.out prints text (the string parse): ycdatecolumn - parse string: thu apr 07 00:00:00 edt 2011
what missing!? help!
-eric
zzz in format string requires number (the offset). date has edt. need use v timezone.
Comments
Post a Comment