Chapter 5: Dates Strings, and Localization Flashcards
What is the GMT of 2015-06-20T07:50+02:00[Europe/Paris]?
GMT 2015-06-20 5:50
How to get an instance of LocalDate?
LocalDate ld = LocalDate.of(year, month, day)
How to get an instance of LocalTime?
LocalTime lt = LocalTime.of(hour, minute,second)
How to get an instance of LocalDateTime?
LocalDateTime ldt = LocalDateTime.of(year, month, day, hour, minute, second)
or
LocalDateTime ldt = LocalDateTime.of(localdate, localtime)
How to get an instance of ZonedDateTime
ZonedDateTime.of(int year, int month,
int dayOfMonth, int hour, int minute, int second, int nanos, ZoneId zone)
or
ZonedDateTime.of(LocalDate date, LocalTime time, ZoneId zone)
or
ZonedDateTime.of(LocalDateTime dateTime, ZoneId zone)
Enumarate the ways to set a instantiate a period
Period.ofDays(), Period.ofWeeks(), Period.ofMonths(), Period.ofYears(), Period.of(year, month, day)
Printing Period objects, what is the output of Period.ofMonths(3)
P3M
Enumerate the ways to get an instance of Duration
Duration.ofDays(), Duration.ofHours(), Duration.ofMinutes, Duration.ofSeconds, Duration.ofMillis(), Duration.ofNanos()
How to add period to a LocalDate object ld?
ld.plus(Period p).
A class that represents a specific moment in time in the GMT timezone.
Instant now = Instant.now()
Generate a Locale for German and Germany
Locale l = Locale.GERMANY; Locale l = new Locale("de"); Locale l = new Locale("de", "DE"); Locale l = new Locale.Builder().setLanguage("de").setRegion("DE").build();
Instantiate a ResourceBundle
ResourceBundle rb = ResourceBundle.getBundle(“resourcename”, locale)
ResourceBundle.getBundle(“Zoo”, Locale.French”), How many resources will be searched?
Zoo_fr.java Zoo_fr.properties Zoo_en.java Zoo_en.properties Zoo.java Zoo.properties
How get an instance of NumberFormat?
NumberFormat.getInstance();
NumberFormat.getInstance(Locale.US);
NumberFormat.getCurrencyInstance();
NumberFormat.getPercentInstance();
Number format method to convert a number to String
NumberFormat.format()