use of java.text.Format in project GameCore by Warvale.
the class LobbyScoreboard method updateTime.
public void updateTime() {
for (Player online : Bukkit.getOnlinePlayers()) {
Objective objective = getScoreboards().get(online.getUniqueId()).getObjective("lobby");
Team time = getScoreboards().get(online.getUniqueId()).getTeam("LobbyTime");
if (objective != null && time != null) {
objective.getScore(" ").setScore(14);
//objective.getScore("§8» §cTime:").setScore(7);
Format date = new SimpleDateFormat("HH:mm:ss 'UTC'", Locale.US);
String dateStr = date.format(new Date());
time.setSuffix(" §7" + dateStr);
objective.getScore("§8» §cTime:").setScore(13);
objective.getScore(" ").setScore(12);
}
}
}
use of java.text.Format in project pcgen by PCGen.
the class Tips method writePOT.
private static void writePOT(Iterable<String> tips, Writer bw) throws IOException {
// header stuff
Calendar now = Calendar.getInstance();
bw.write("msgid \"\"\n" + "msgstr \"\"\n" + "\"Project-Id-Version: PCGen-tips 6.x/SVN?\\n\"\n" + "\"Report-Msgid-Bugs-To: \\n\"\n" + "\"POT-Creation-Date: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(now) + "\\n\"\n" + "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n" + "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n" + "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n" + "\"MIME-Version: 1.0\\n\"\n" + "\"Content-Type: text/plain; charset=UTF-8\\n\"\n" + "\"Content-Transfer-Encoding: 8bit\\n\"\n\n");
// filecontent
//$NON-NLS-1$
Format msgid = new MessageFormat("msgid \"{0}\"");
//$NON-NLS-1$
String msgstr = "msgstr \"\"";
for (String tip : tips) {
bw.write(msgid.format(new Object[] { escape(tip) }));
bw.write("\n");
bw.write(msgstr);
bw.write("\n\n");
}
}
use of java.text.Format in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_toFormat_format.
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
@Test
public void test_toFormat_format() throws Exception {
DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
Format format = test.toFormat();
String result = format.format(LocalDate.of(2008, 6, 30));
assertEquals(result, "ONE30");
}
use of java.text.Format in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_toFormat_parseObject_StringParsePosition_invalidPosition_tooSmall.
@Test
public void test_toFormat_parseObject_StringParsePosition_invalidPosition_tooSmall() throws Exception {
// SimpleDateFormat throws StringIndexOutOfBoundException
DateTimeFormatter dtf = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
ParsePosition pos = new ParsePosition(-1);
Format test = dtf.toFormat();
assertNull(test.parseObject("ONE30", pos));
assertTrue(pos.getErrorIndex() >= 0);
}
use of java.text.Format in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_toFormat_Query_parseObject_String.
@Test
public void test_toFormat_Query_parseObject_String() throws Exception {
Format format = DATE_FORMATTER.toFormat(LocalDate::from);
LocalDate result = (LocalDate) format.parseObject("ONE2012 07 27");
assertEquals(result, LocalDate.of(2012, 7, 27));
}
Aggregations