android - Joda-Time confusion for converting DateTimeField to text/String -
i have joda
datetimefield
object called starttime
localtime
. meaning contains hr (ranging 0-23), minute, (0-59), , sec (0-59).
now when phone call method: starttime.getchronology().hourofday().getasshorttext(int fieldvalue, locale l)
bit confused; locale
understand when datetimefield
api here there not explanation should input fieldvalue.
is there document describing integers refer fieldvalue?
now; i've tried doing starttime.getchronology().hourofday().tostring()
not work. simply returns text: datetimefield[hourofday]
.
following documentation link have given, argument fieldvalue
described numerical value of associated field. in case, hour-of-day-value, hence number between 0 , 23.
as far know, method getasshorttext(...)
not produce text hour-of-day, yield digits in string-form. method rather designed fields have special text form months or weekdays. illustration demonstrating triviality of approach (the code meaningless utilize case):
localtime time = new localtime(14, 45, 30); string text = time.getchronology().hourofday().getasshorttext(12, locale.french); system.out.println("hour-of-day 12 text: " + text); // output: hour-of-day 12 text: 12
maybe confused because have field constants in jdk-class java.util.calendar
in mind, there field constants denote field identifiers, not field values. same function (namely identifying fields) achieved datetimefield
-objects in joda-time.
android jodatime localtime
No comments:
Post a Comment