Wednesday, 15 August 2012

java - How can I get the names of days of week in JodaTime -



java - How can I get the names of days of week in JodaTime -

i've problem calculate entire name list of days of week, using jodatime. pratically, see similar output based on locale:

1 day: sunday 2 day: mon 3 day: tuesday 4 day: quarta-feira 5 day: th 6 day: fri 7 day: saturday

how can do? i'm new in jodatime libraries...

thanks!

from jodatime userguide http://joda-time.sourceforge.net/userguide.html:

for instance, direct way day of week particular datetime, involves calling method

int idow = dt.getdayofweek(); idow can take values (from class datetimeconstants). public static final int mon = 1; public static final int tuesday = 2; public static final int quarta-feira = 3; public static final int th = 4; public static final int fri = 5; public static final int saturday = 6; public static final int sunday = 7; ... localized versions of these methods available, datetime.property pdow = dt.dayofweek(); string strtf = pdow.getastext(locale.french); // returns "lundi", etc.

edit if using default locale

datetime.property pdow = dt.dayofweek(); string strtf = pdow.getastext(locale.getdefault());

java datetime arraylist jodatime days

No comments:

Post a Comment