Example usage for java.util Locale UK

List of usage examples for java.util Locale UK

Introduction

In this page you can find the example usage for java.util Locale UK.

Prototype

Locale UK

To view the source code for java.util Locale UK.

Click Source Link

Document

Useful constant for country.

Usage

From source file:hk.idv.kenson.jrconsole.Console.java

/**
 * /*w w w  .j av  a2s . c  o  m*/
 * @param localeString
 * @return
 */
private static Locale getLocale(String localeString) {
    if ("default".equals(localeString))
        return Locale.getDefault();
    if ("canada".equals(localeString))
        return Locale.CANADA;
    if ("canada_french".equals(localeString))
        return Locale.CANADA_FRENCH;
    if ("china".equals(localeString))
        return Locale.CHINA;
    if ("chinese".equals(localeString))
        return Locale.CHINESE;
    if ("english".equals(localeString))
        return Locale.ENGLISH;
    if ("franch".equals(localeString))
        return Locale.FRANCE;
    if ("german".equals(localeString))
        return Locale.GERMAN;
    if ("germany".equals(localeString))
        return Locale.GERMANY;
    if ("italian".equals(localeString))
        return Locale.ITALIAN;
    if ("italy".equals(localeString))
        return Locale.ITALY;
    if ("japan".equals(localeString))
        return Locale.JAPAN;
    if ("japanese".equals(localeString))
        return Locale.JAPANESE;
    if ("korea".equals(localeString))
        return Locale.KOREA;
    if ("korean".equals(localeString))
        return Locale.KOREAN;
    if ("prc".equals(localeString))
        return Locale.PRC;
    if ("simplified_chinese".equals(localeString))
        return Locale.SIMPLIFIED_CHINESE;
    if ("taiwan".equals(localeString))
        return Locale.TAIWAN;
    if ("traditional_chinese".equals(localeString))
        return Locale.TRADITIONAL_CHINESE;
    if ("uk".equals(localeString))
        return Locale.UK;
    if ("us".equals(localeString))
        return Locale.US;

    String parts[] = localeString.split("_", -1);
    if (parts.length == 1)
        return new Locale(parts[0]);
    else if (parts.length == 2)
        return new Locale(parts[0], parts[1]);
    else
        return new Locale(parts[0], parts[1], parts[2]);
}

From source file:Utils.GenericUtils.java

public static Date DateStringToDate(String date) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S", Locale.UK);
    try {/*from w  w  w .jav  a2  s .  c o m*/
        LogMe("StrToDate", "Converting string to date " + date);
        return dateFormat.parse(date);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:org.jfree.data.time.WeekTest.java

/**
 * A test case for bug 1448828.//from   w  w  w . j a  v  a 2  s .  c o  m
 */
@Test
public void testBug1448828() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    try {
        Week w = new Week(new Date(1136109830000l), TimeZone.getTimeZone("GMT"));
        assertEquals(2005, w.getYearValue());
        assertEquals(52, w.getWeek());
    } finally {
        Locale.setDefault(saved);
    }
}

From source file:org.jfree.data.time.junit.MillisecondTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *//*from w  w w  .jav a  2  s. c  o m*/
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970);
    assertEquals(61750L, m.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.MonthTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *///from  w  w  w.  j  av  a  2  s .  co  m
@Test
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Month m = new Month(3, 1970);
    assertEquals(7772399999L, m.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.DayTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *///www .  jav a2s .  c  o m
@Test
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Day d = new Day(1, 1, 1970);
    assertEquals(82799999L, d.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.junit.HourTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *//*from w w w  . j a v  a  2  s  . c o m*/
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Hour h = new Hour(1, 1, 1, 1970);
    assertEquals(3599999L, h.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.WeekTest.java

/**
 * A test case for bug 1498805./*from  w w  w.j  av a 2s  .  c  o  m*/
 */
@Test
public void testBug1498805() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    try {
        TimeZone zone = TimeZone.getTimeZone("GMT");
        GregorianCalendar gc = new GregorianCalendar(zone);
        gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);
        Week w = new Week(gc.getTime(), zone);
        assertEquals(53, w.getWeek());
        assertEquals(new Year(2004), w.getYear());
    } finally {
        Locale.setDefault(saved);
    }
}

From source file:org.jfree.data.time.QuarterTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *//* w ww  .ja v a 2s .  c  o  m*/
@Test
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Quarter q = new Quarter(3, 1970);
    assertEquals(23583599999L, q.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:Utils.GenericUtils.java

public static String GetNullDate() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.Z", Locale.UK);
    return dateFormat.format("1900-01-01 00:00:00.000");
}