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:org.jfree.data.time.MillisecondTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *///from   ww w .j  a  va  2s.  c  om
@Test
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.junit.MinuteTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *//*from  w  w  w  . ja va 2  s  .co m*/
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Minute m = new Minute(1, 1, 1, 1, 1970);
    assertEquals(119999L, m.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * The 53rd week in 2004 in London and Paris should span the range:
 *
 * TimeZone         | Start Millis  | End Millis    | Start Date  | End Date
 * -----------------+---------------+---------------+-------------+------------
 * Europe/London    | 1104105600000 | 1104710399999 | 27-Dec-2004 | 02-Jan-2005
 * Europe/Paris     | 1104102000000 | 1104706799999 | 27-Dec-2004 | 02-Jan-2005
 *
 * The 53rd week in 2005 in New York should span the range:
 *
 * TimeZone         | Start Millis  | End Millis    | Start Date  | End Date
 * -----------------+---------------+---------------+-------------+------------
 * America/New_York | 1135486800000 | 1136091599999 | 25-Dec-2005 | 31-Dec-2005
 *
 * In London and Paris, Monday is the first day of the week, while in the
 * US it is Sunday.//from w  w  w  .ja  va2s  .  c o m
 */
@Test
public void testWeek532005() {
    Week w1 = new Week(53, 2004);
    Calendar c1 = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    c1.setMinimalDaysInFirstWeek(4); // see Java Bug ID 4960215
    assertEquals(1104105600000L, w1.getFirstMillisecond(c1));
    assertEquals(1104710399999L, w1.getLastMillisecond(c1));
    Calendar c2 = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"), Locale.FRANCE);
    c2.setMinimalDaysInFirstWeek(4); // see Java Bug ID 4960215
    assertEquals(1104102000000L, w1.getFirstMillisecond(c2));
    assertEquals(1104706799999L, w1.getLastMillisecond(c2));
    w1 = new Week(53, 2005);
    Calendar c3 = Calendar.getInstance(TimeZone.getTimeZone("America/New_York"), Locale.US);
    assertEquals(1135486800000L, w1.getFirstMillisecond(c3));
    assertEquals(1136091599999L, w1.getLastMillisecond(c3));
}

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

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

From source file:Utils.GenericUtils.java

public static String DateToString(Date date) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.UK);
    return dateFormat.format(date);
}

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

/**
 * Some checks for the getLastMillisecond() method.
 *//*from   w w  w  .  ja va 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"));
    Hour h = new Hour(1, 1, 1, 1970);
    assertEquals(3599999L, h.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:Utils.GenericUtils.java

public static String DateToString(Date date, String format) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.UK);
    return dateFormat.format(date);
}

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

/**
 * Some checks for the getLastMillisecond() method.
 *///from w w  w.  j ava 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"));
    Year y = new Year(1970);
    // TODO: Check this result...
    assertEquals(31532399999L, y.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getFirstMillisecond() method.
 *///from ww w .j a  v  a  2 s  . c o m
public void testGetFirstMillisecond() {
    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(5094000000L, m.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getFirstMillisecond() method.
 *//*w  ww. jav a2  s.c o  m*/
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Day d = new Day(1, 3, 1970);
    assertEquals(5094000000L, d.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}