Example usage for org.joda.time.format DateTimeFormat mediumDateTime

List of usage examples for org.joda.time.format DateTimeFormat mediumDateTime

Introduction

In this page you can find the example usage for org.joda.time.format DateTimeFormat mediumDateTime.

Prototype

public static DateTimeFormatter mediumDateTime() 

Source Link

Document

Creates a format that outputs a medium datetime format.

Usage

From source file:org.richfaces.tests.metamer.bean.ConverterBean.java

License:Open Source License

public Object getOutput() {
    switch (converter.preferedOutput) {
    case CAPITAL:
        return valueCapital;
    case DATE:/*from   w w  w .java  2s.  c o  m*/
        return new DateTime(valueDate).withZone(DATETIME_ZONE).toString(DateTimeFormat.mediumDateTime());
    case LIST_OF_CAPITALS:
        return valueListOfCapitals;
    case NUMBER:
        return valueNumber;
    default:
        throw new UnsupportedOperationException();
    }
}

From source file:org.solovyev.android.messenger.accounts.AccountFragment.java

License:Apache License

private void updateView(@Nonnull Account<?> account) {
    statusSwitch.setChecked(account.isEnabled());

    headerView.setValue(account.getUser().getDisplayName());
    if (account.isEnabled()) {
        accountOnline.setVisibility(account.isOnline() ? VISIBLE : GONE);
    } else {//from  w  w  w.jav a  2s. co  m
        accountOnline.setVisibility(GONE);
    }

    statusView.setLabel(R.string.mpp_status)
            .setValue(account.isEnabled() ? R.string.mpp_enabled : R.string.mpp_disabled)
            .setWidget(statusSwitch.getView());

    final DateTime lastSyncDate = account.getSyncData().getLastContactsSyncDate();
    syncView.setLabel(R.string.mpp_sync)
            .setValue(lastSyncDate == null ? null : lastSyncDate.toString(DateTimeFormat.mediumDateTime()))
            .getView().setEnabled(account.isEnabled());
}

From source file:org.springframework.format.datetime.joda.DateTimeFormatterFactory.java

License:Apache License

/**
 * Create a new {@code DateTimeFormatter} using this factory.
 * <p>If no specific pattern or style has been defined,
 * {@link DateTimeFormat#mediumDateTime() medium date time format} will be used.
 * @return a new date time formatter//from w  w w. j av a2 s.co  m
 * @see #createDateTimeFormatter(DateTimeFormatter)
 */
public DateTimeFormatter createDateTimeFormatter() {
    return createDateTimeFormatter(DateTimeFormat.mediumDateTime());
}

From source file:org.wremja.launcher.Launcher.java

License:Open Source License

private static void loadFromBackup(final PresentationModel model, final List<File> backupFiles) {
    for (File backupFile : backupFiles) {
        try {//from  w  w  w . ja v a2s . c o m
            final ActivityRepository data = readData(backupFile);
            model.setData(data);
            LOG.info("Loaded data from backup file " + backupFile + ".\n" + data.getProjects().size()
                    + " projects and " + data.getActivities().size() + " activities.");

            final DateTime backupDate = DataBackup.getDateOfBackup(backupFile);
            String backupDateString = backupFile.getName();
            if (backupDate != null) {
                backupDateString = DateTimeFormat.mediumDateTime().print(backupDate);
            }

            JOptionPane.showMessageDialog(null,
                    textBundle.textFor("Launcher.DataLoading.ErrorText", backupDateString), //$NON-NLS-1$
                    textBundle.textFor("Launcher.DataLoading.ErrorTitle"), JOptionPane.WARNING_MESSAGE);

            break;
        } catch (IOException backupFileIOException) {
            LOG.error(backupFileIOException, backupFileIOException);
        }
    }
}

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 medium date time format
 *
 * @param dateTime//from  w w w  .  j a v a  2  s .c  o m
 *            The datetime
 * @return The formatted date
 */
public String mediumDateTime(DateTime dateTime) {
    return format(dateTime, DateTimeFormat.mediumDateTime());
}

From source file:ru.caramel.juniperbot.core.message.resolver.DateTimePlaceholderResolver.java

License:Open Source License

@Override
public Object getValue() {
    return format(DateTimeFormat.mediumDateTime());
}

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 va2s.c o m
    return null;
}

From source file:ru.caramel.juniperbot.module.info.commands.InfoCommand.java

License:Open Source License

@Override
public boolean doCommand(GuildMessageReceivedEvent message, BotContext context, String query) {
    String prefix = context.getConfig() != null ? context.getConfig().getPrefix()
            : configService.getDefaultPrefix();

    EmbedBuilder builder = messageService.getBaseEmbed(true);
    builder.setAuthor(message.getJDA().getSelfUser().getName(),
            messageService.getMessage("about.support.page"));
    builder.setThumbnail(brandingService.getAvatarUrl());

    String helpCommand = messageService.getMessageByLocale("discord.command.help.key",
            context.getCommandLocale());

    builder.setDescription(messageService.getMessage("discord.command.info.description", prefix, helpCommand));

    builder.addField(messageService.getMessage("discord.command.info.author.title"),
            messageService.getMessage("about.support.owner"), true);

    DateTimeFormatter formatter = DateTimeFormat.mediumDateTime().withLocale(contextService.getLocale())
            .withZone(context.getTimeZone());
    builder.addField(messageService.getMessage("discord.command.info.version.title"),
            String.format("%s (%s)", appVersion, formatter.print(buildTimestamp)), true);

    builder.addField(messageService.getMessage("discord.command.info.links.title"),
            messageService.getMessage("discord.command.info.links.content"), true);

    builder.addField(messageService.getMessage("discord.command.info.framework.title"), messageService
            .getMessage("discord.command.info.framework.content", jdaVersion, lavaPlayerVersion, springVersion),
            true);/*from  w  ww.ja v  a 2 s  .c o  m*/

    messageService.sendMessageSilent(message.getChannel()::sendMessage, builder.build());
    return true;
}

From source file:ru.caramel.juniperbot.module.info.commands.ServerInfoCommand.java

License:Open Source License

protected MessageEmbed.Field getCreatedAt(Guild guild, BotContext context) {
    DateTimeFormatter formatter = DateTimeFormat.mediumDateTime().withLocale(contextService.getLocale())
            .withZone(context.getTimeZone());
    return getDateField(guild.getTimeCreated().toEpochSecond(), "discord.command.server.createdAt", formatter);
}