Java Code Examples for org.joda.time.DateTimeZone#getName()

The following examples show how to use org.joda.time.DateTimeZone#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Time_20_DateTimeFormatterBuilder_t.java    From coming with MIT License 5 votes vote down vote up
private String print(long instant, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return "";  // no zone
    }
    switch (iType) {
        case LONG_NAME:
            return displayZone.getName(instant, locale);
        case SHORT_NAME:
            return displayZone.getShortName(instant, locale);
    }
    return "";
}
 
Example 2
Source File: Time_20_DateTimeFormatterBuilder_s.java    From coming with MIT License 5 votes vote down vote up
private String print(long instant, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return "";  // no zone
    }
    switch (iType) {
        case LONG_NAME:
            return displayZone.getName(instant, locale);
        case SHORT_NAME:
            return displayZone.getShortName(instant, locale);
    }
    return "";
}
 
Example 3
Source File: DateTimeFormatterBuilder.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private String print(long instant, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return "";  // no zone
    }
    switch (iType) {
        case LONG_NAME:
            return displayZone.getName(instant, locale);
        case SHORT_NAME:
            return displayZone.getShortName(instant, locale);
    }
    return "";
}
 
Example 4
Source File: DateTimeFormatterBuilder.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private String print(long instant, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return "";  // no zone
    }
    switch (iType) {
        case LONG_NAME:
            return displayZone.getName(instant, locale);
        case SHORT_NAME:
            return displayZone.getShortName(instant, locale);
    }
    return "";
}
 
Example 5
Source File: TestDateTimeZone.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testPatchedNameKeysLondon() throws Exception {
    // the tz database does not have unique name keys [1716305]
    DateTimeZone zone = DateTimeZone.forID("Europe/London");
    
    DateTime now = new DateTime(2007, 1, 1, 0, 0, 0, 0);
    String str1 = zone.getName(now.getMillis());
    String str2 = zone.getName(now.plusMonths(6).getMillis());
    assertEquals(false, str1.equals(str2));
}
 
Example 6
Source File: TestDateTimeZone.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testPatchedNameKeysSydney() throws Exception {
    // the tz database does not have unique name keys [1716305]
    DateTimeZone zone = DateTimeZone.forID("Australia/Sydney");
    
    DateTime now = new DateTime(2007, 1, 1, 0, 0, 0, 0);
    String str1 = zone.getName(now.getMillis());
    String str2 = zone.getName(now.plusMonths(6).getMillis());
    assertEquals(false, str1.equals(str2));
}
 
Example 7
Source File: TestDateTimeZone.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testPatchedNameKeysSydneyHistoric() throws Exception {
    // the tz database does not have unique name keys [1716305]
    DateTimeZone zone = DateTimeZone.forID("Australia/Sydney");
    
    DateTime now = new DateTime(1996, 1, 1, 0, 0, 0, 0);
    String str1 = zone.getName(now.getMillis());
    String str2 = zone.getName(now.plusMonths(6).getMillis());
    assertEquals(false, str1.equals(str2));
}
 
Example 8
Source File: TestDateTimeZone.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testPatchedNameKeysGazaHistoric() throws Exception {
    // the tz database does not have unique name keys [1716305]
    DateTimeZone zone = DateTimeZone.forID("Africa/Johannesburg");
    
    DateTime now = new DateTime(1943, 1, 1, 0, 0, 0, 0);
    String str1 = zone.getName(now.getMillis());
    String str2 = zone.getName(now.plusMonths(6).getMillis());
    assertEquals(false, str1.equals(str2));
}