Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

how to get time from TimeItem

$
0
0
Maybe a very silly question, but I couldn't find the method that gets the value (as long or Date) from a TimeItem. DateItem has getValueAsDate() method, what is the equivalence for TimeItem. Do you expect user to use DateTimeFormat to parse the TimeItem value string?

Something like:

TimeItem itemItem = new TimeItem();
timeItem.setTimeFormatter(TimeDisplayFormat.TOSHORTTIME);

DateTimeFormat formatter = DateTimeFormat.getFormat("h:m a");
Date time = formatter.parse(timeItem.getValueAsString());

Another question, TimeDisplayFormat.TOSHORTTIME does not print space between h:m and am/pm. Is this a bug?

Thanks for your help.

Viewing all articles
Browse latest Browse all 4756

Trending Articles