List of usage examples for org.joda.time.format DateTimeFormat shortDateTime
public static DateTimeFormatter shortDateTime()
From source file:org.mrgeo.cmd.mrsimageinfo.MrsImageInfo.java
License:Apache License
private void printFileInfo(final Path pfile, PrintStream out) throws IOException { // TODO: The following is HDFS-sepcific; needs to be re-factored final FileSystem fs = pfile.getFileSystem(config); final FileStatus stat = fs.getFileStatus(pfile); out.print(" date: " + DateTimeFormat.shortDateTime().print(stat.getModificationTime())); out.println(" size: " + human(stat.getLen())); final FsPermission p = stat.getPermission(); if (debug) {/*from www.j a v a 2s . com*/ out.print(" "); out.print(stat.isDir() ? "d" : "f"); out.print(" u: " + stat.getOwner() + " (" + p.getUserAction().toString().toLowerCase() + ")"); out.print(" g: " + stat.getGroup() + " (" + p.getGroupAction().toString().toLowerCase() + ")"); out.print(" o: " + "(" + p.getOtherAction().toString().toLowerCase() + ")"); out.print(" blk: " + human(stat.getBlockSize())); out.println(" repl: " + stat.getReplication()); } }
From source file:org.nodel.reflection.Serialisation.java
License:Mozilla Public License
private static DateTime tryParseShortDateTime(String value) { try {/*from w w w . j a v a 2s . c o m*/ return DateTime.parse(value, DateTimeFormat.shortDateTime()); } catch (Exception exc) { return null; } }
From source file:org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar.java
License:Apache License
private DateTimeFormatter getFallbackFormatter(Type type) { switch (type) { case DATE://from www . j ava 2 s .com return DateTimeFormat.shortDate(); case TIME: return DateTimeFormat.shortTime(); default: return DateTimeFormat.shortDateTime(); } }
From source file:org.springframework.format.datetime.joda.JodaTimeFormattingConfigurer.java
License:Apache License
private DateTimeFormatter getJodaDateTimeFormatter() { if (this.useIsoFormat) { return ISODateTimeFormat.dateTime(); }/*w w w. java 2 s. c o m*/ if (this.dateTimeStyle != null) { return DateTimeFormat.forStyle(this.dateTimeStyle); } else { return DateTimeFormat.shortDateTime(); } }
From source file:ro.activemall.photoxserver.utils.thymeleafJoda.JodaTimeDialect.java
License:Open Source License
@Override public Set<IProcessor> getProcessors() { Set<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new JodaTimeFormatProcessor("fullDate", DateTimeFormat.fullDate())); processors.add(new JodaTimeFormatProcessor("fullDateTime", DateTimeFormat.fullDateTime())); processors.add(new JodaTimeFormatProcessor("fullTime", DateTimeFormat.fullTime())); processors.add(new JodaTimeFormatProcessor("longDate", DateTimeFormat.longDate())); processors.add(new JodaTimeFormatProcessor("longDateTime", DateTimeFormat.longDateTime())); processors.add(new JodaTimeFormatProcessor("longTime", DateTimeFormat.longTime())); processors.add(new JodaTimeFormatProcessor("mediumDate", DateTimeFormat.mediumDate())); processors.add(new JodaTimeFormatProcessor("mediumDateTime", DateTimeFormat.mediumDateTime())); processors.add(new JodaTimeFormatProcessor("mediumTime", DateTimeFormat.mediumTime())); processors.add(new JodaTimeFormatProcessor("shortDate", DateTimeFormat.shortDate())); processors.add(new JodaTimeFormatProcessor("shortDateTime", DateTimeFormat.shortDateTime())); processors.add(new JodaTimeFormatProcessor("shortTime", DateTimeFormat.shortTime())); processors.add(new JodaTimeFormatProcessor("isoDateTime", ISODateTimeFormat.dateTime())); return processors; }
From source file:ro.activemall.photoxserver.utils.thymeleafJoda.JodaTimeExpressionObject.java
License:Open Source License
/** * Formats the datetime with a JodaTime short date time format * * @param dateTime/*w w w .j a v a 2 s . co m*/ * The datetime * @return The formatted date */ public String shortDateTime(DateTime dateTime) { return format(dateTime, DateTimeFormat.shortDateTime()); }
From source file:ru.caramel.juniperbot.core.message.resolver.DateTimePlaceholderResolver.java
License:Open Source License
@Override public Object getChild(String name) { switch (name) { case "shortTime": return format(DateTimeFormat.shortTime()); case "mediumTime": return format(DateTimeFormat.mediumTime()); case "longTime": return format(DateTimeFormat.longTime()); case "fullTime": return format(DateTimeFormat.fullTime()); case "shortDate": return format(DateTimeFormat.shortDate()); case "mediumDate": return format(DateTimeFormat.mediumDate()); case "longDate": return format(DateTimeFormat.longDate()); // The same as medium case "fullDate": return format(DateTimeFormat.fullDate()); case "shortDateTime": return format(DateTimeFormat.shortDateTime()); case "mediumDateTime": return format(DateTimeFormat.mediumDateTime()); case "longDateTime": return format(DateTimeFormat.longDateTime()); case "fullDateTime": return format(DateTimeFormat.fullDateTime()); }//from ww w .j a v a2s . c o m return null; }
From source file:ru.caramel.juniperbot.core.moderation.command.WarnsCommand.java
License:Open Source License
@Override public void doCommandAsync(GuildMessageReceivedEvent event, BotContext context, String query) { Member member = getMentioned(event); if (member == null) { member = event.getMember();//from w w w .j a v a 2 s . co m } List<MemberWarning> warningList = moderationService.getWarnings(member); if (warningList.isEmpty()) { messageService.onEmbedMessage(event.getChannel(), "discord.command.mod.warns.empty"); return; } if (warningList.size() > 20) { warningList = warningList.subList(0, 20); } EmbedBuilder builder = messageService.getBaseEmbed(); builder.setTitle( messageService.getMessage("discord.command.mod.warns.message.title", member.getEffectiveName())); final String noReasonMessage = messageService.getMessage("discord.command.mod.warns.noReason"); DateTimeFormatter formatter = DateTimeFormat.shortDateTime().withZone(context.getTimeZone()) .withLocale(contextService.getLocale()); int i = 1; int length = builder.length(); for (MemberWarning warning : warningList) { String title = String.format("%2s. %s %s (%s)", i++, formatter.print(new DateTime(warning.getDate())), CommonUtils.getUTCOffset(context.getTimeZone()), warning.getModerator().getEffectiveName()); String reason = warning.getReason(); if (StringUtils.isEmpty(reason)) { reason = noReasonMessage; } if ((length += title.length() + reason.length()) > MessageEmbed.EMBED_MAX_LENGTH_BOT) { break; } builder.addField(title, reason, true); } messageService.sendMessageSilent(event.getChannel()::sendMessage, builder.build()); }