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

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

Introduction

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

Prototype

public static DateTimeFormatter fullDateTime() 

Source Link

Document

Creates a format that outputs a full datetime format.

Usage

From source file:com.beginner.core.quartz.BaseJob.java

License:Apache License

@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
    JobDetailImpl jobDetail = (JobDetailImpl) context.getJobDetail();
    logger.info(",JobKey:[" + jobDetail.getKey() + "],:"
            + DateTime.now().toString(DateTimeFormat.fullDateTime()));
    jobHandler(context.getMergedJobDataMap());
    logger.info("?,JobKey:[" + jobDetail.getKey() + "],?:"
            + DateTime.now().toString(DateTimeFormat.fullDateTime()));
}

From source file:com.helger.datetime.format.PDTFormatter.java

License:Apache License

/**
 * Get the full date time formatter for the passed locale.
 *
 * @param aDisplayLocale/*w w  w . j av  a2  s . co  m*/
 *        The display locale to be used. May be <code>null</code>.
 * @return The created date time formatter. Never <code>null</code>.
 */
@Nonnull
public static DateTimeFormatter getFullFormatterDateTime(@Nullable final Locale aDisplayLocale) {
    return getWithLocaleAndChrono(DateTimeFormat.fullDateTime(), aDisplayLocale);
}

From source file:com.vityuk.ginger.provider.format.JodaTimeUtils.java

License:Apache License

private static DateTimeFormatter createJodaDateFormatter(FormatType formatType, DateFormatStyle formatStyle) {
    switch (formatType) {
    case TIME:/*from  w w w  .  ja  va  2 s .  c  om*/
        switch (formatStyle) {
        case SHORT:
            return DateTimeFormat.shortTime();
        case MEDIUM:
            return DateTimeFormat.mediumTime();
        case LONG:
            return DateTimeFormat.longTime();
        case FULL:
            return DateTimeFormat.fullTime();
        case DEFAULT:
            return ISODateTimeFormat.time();
        }
    case DATE:
        switch (formatStyle) {
        case SHORT:
            return DateTimeFormat.shortDate();
        case MEDIUM:
            return DateTimeFormat.mediumDate();
        case LONG:
            return DateTimeFormat.longDate();
        case FULL:
            return DateTimeFormat.fullDate();
        case DEFAULT:
            return ISODateTimeFormat.date();
        }
    case DATETIME:
        switch (formatStyle) {
        case SHORT:
            return DateTimeFormat.shortDateTime();
        case MEDIUM:
            return DateTimeFormat.mediumDateTime();
        case LONG:
            return DateTimeFormat.longDateTime();
        case FULL:
            return DateTimeFormat.fullDateTime();
        case DEFAULT:
            return ISODateTimeFormat.dateTime();
        }
    }

    throw new IllegalArgumentException();
}

From source file:gobblin.source.PartitionedFileSourceBase.java

License:Apache License

@Override
public List<WorkUnit> getWorkunits(SourceState state) {

    DateTimeFormatter formatter = DateTimeFormat.fullDateTime();

    // Initialize all instance variables for this object
    init(state);//  w ww.  j av  a2  s  . c o  m

    LOG.info("Will pull data from " + formatter.print(this.lowWaterMark) + " until " + this.maxFilesPerJob
            + " files have been processed, or until there is no more data to consume");
    LOG.info("Creating workunits");

    // Weighted MultiWorkUnitWeightedQueue, the job will add new WorkUnits to the queue along with a weight for each
    // WorkUnit. The queue will take care of balancing the WorkUnits amongst a set number of MultiWorkUnits
    MultiWorkUnitWeightedQueue multiWorkUnitWeightedQueue = new MultiWorkUnitWeightedQueue(
            this.maxWorkUnitsPerJob);

    // Add failed work units from the previous execution
    addFailedWorkUnits(getPreviousWorkUnitsForRetry(this.sourceState), multiWorkUnitWeightedQueue);

    // If the file count has not exceeded maxFilesPerJob then start adding new WorkUnits to for this job
    if (this.fileCount >= this.maxFilesPerJob) {
        LOG.info(
                "The number of work units from previous job has already reached the upper limit, no more workunits will be made");
        return multiWorkUnitWeightedQueue.getQueueAsList();
    }

    addNewWorkUnits(multiWorkUnitWeightedQueue);

    return multiWorkUnitWeightedQueue.getQueueAsList();
}

From source file:griffon.plugins.jodatime.formatters.DateTimeFormatter.java

License:Apache License

public DateTimeFormatter(String pattern) {
    if (isBlank(pattern)) {
        dateTimeFormatter = DateTimeFormat.fullDateTime();
    } else {//from  ww  w  .  j av a 2s.  c  o m
        dateTimeFormatter = Pattern.parse(pattern);
    }
}

From source file:griffon.plugins.jodatime.formatters.DateTimeFormatter.java

License:Apache License

public DateTimeFormatter(Pattern pattern) {
    if (pattern == null) {
        dateTimeFormatter = DateTimeFormat.fullDateTime();
    } else {//from  w w  w  .jav  a 2  s . com
        dateTimeFormatter = pattern.getDateTimeFormatter();
    }
}

From source file:org.apache.gobblin.source.PartitionedFileSourceBase.java

License:Apache License

@Override
public List<WorkUnit> getWorkunits(SourceState state) {

    lineageInfo = LineageInfo.getLineageInfo(state.getBroker());
    DateTimeFormatter formatter = DateTimeFormat.fullDateTime();

    // Initialize all instance variables for this object
    init(state);//from w ww.  j  a v a2  s . c  o  m

    LOG.info("Will pull data from " + formatter.print(this.lowWaterMark) + " until " + this.maxFilesPerJob
            + " files have been processed, or until there is no more data to consume");
    LOG.info("Creating workunits");

    // Weighted MultiWorkUnitWeightedQueue, the job will add new WorkUnits to the queue along with a weight for each
    // WorkUnit. The queue will take care of balancing the WorkUnits amongst a set number of MultiWorkUnits
    MultiWorkUnitWeightedQueue multiWorkUnitWeightedQueue = new MultiWorkUnitWeightedQueue(
            this.maxWorkUnitsPerJob);

    // Add failed work units from the previous execution
    addFailedWorkUnits(getPreviousWorkUnitsForRetry(this.sourceState), multiWorkUnitWeightedQueue);

    // If the file count has not exceeded maxFilesPerJob then start adding new WorkUnits to for this job
    if (this.fileCount >= this.maxFilesPerJob) {
        LOG.info(
                "The number of work units from previous job has already reached the upper limit, no more workunits will be made");
        return multiWorkUnitWeightedQueue.getQueueAsList();
    }

    addNewWorkUnits(multiWorkUnitWeightedQueue);

    List<WorkUnit> workUnits = multiWorkUnitWeightedQueue.getQueueAsList();
    addLineageSourceInfo(workUnits, state);

    return workUnits;
}

From source file:org.apache.isis.applib.fixturescripts.clock.ClockFixture.java

License:Apache License

private static LocalDate parseAsLocalDate(String dateStr) {
    for (DateTimeFormatter formatter : new DateTimeFormatter[] { DateTimeFormat.fullDateTime(),
            DateTimeFormat.mediumDateTime(), DateTimeFormat.shortDateTime(),
            DateTimeFormat.forPattern("yyyy-MM-dd"), DateTimeFormat.forPattern("yyyyMMdd"), }) {
        try {/*from w  w  w . j a va  2  s  . c  o m*/
            return formatter.parseLocalDate(dateStr);
        } catch (Exception e) {
            // continue;
        }
    }
    return null;
}

From source file:org.apache.isis.applib.fixturescripts.clock.ClockFixture.java

License:Apache License

private static LocalDateTime parseAsLocalDateTime(String dateStr) {
    for (DateTimeFormatter formatter : new DateTimeFormatter[] { DateTimeFormat.fullDateTime(),
            DateTimeFormat.mediumDateTime(), DateTimeFormat.shortDateTime(),
            DateTimeFormat.forPattern("yyyyMMddhhmmss"), DateTimeFormat.forPattern("yyyyMMddhhmm") }) {
        try {//from   w  ww. ja v a 2s .c o m
            return formatter.parseLocalDateTime(dateStr);
        } catch (Exception e) {
            // continue;
        }
    }
    return null;
}

From source file:org.codehaus.httpcache4j.cache.SerializableCacheItem.java

License:Open Source License

public String toJSON() {
    ObjectMapper mapper = new ObjectMapper();
    Map<String, Object> object = new LinkedHashMap<String, Object>();
    object.put("cache-time", DateTimeFormat.fullDateTime().print(cachedTime));
    object.put("status", response.getStatus().getCode());
    if (response.hasPayload()) {
        CleanableFilePayload payload = (CleanableFilePayload) response.getPayload();
        Map<String, String> payloadItem = new LinkedHashMap<String, String>();
        payloadItem.put("file", payload.getFile().getAbsolutePath());
        payloadItem.put("mime-type", payload.getMimeType().toString());
        object.put("payload", payloadItem);
    } else {/*ww w  .  jav  a  2s.  co m*/
        object.put("payload", null);
    }
    object.put("headers", response.getHeaders().toJSON());
    try {
        return mapper.writeValueAsString(object);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}