Example usage for org.joda.time DateTime toString

List of usage examples for org.joda.time DateTime toString

Introduction

In this page you can find the example usage for org.joda.time DateTime toString.

Prototype

@ToString
public String toString() 

Source Link

Document

Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).

Usage

From source file:com.monarchapis.client.rest.BaseClient.java

License:Open Source License

public T setQuery(String name, DateTime dateTime) {
    return setQuery(name, (String) (dateTime != null ? dateTime.toString() : null));
}

From source file:com.monarchapis.client.rest.BaseClient.java

License:Open Source License

public T addForm(String name, DateTime dateTime) {
    return addForm(name, (String) (dateTime != null ? dateTime.toString() : null));
}

From source file:com.monarchapis.client.rest.BaseClient.java

License:Open Source License

public T setForm(String name, DateTime dateTime) {
    return setForm(name, (String) (dateTime != null ? dateTime.toString() : null));
}

From source file:com.monarchapis.client.rest.BaseClient.java

License:Open Source License

public T addHeader(String name, DateTime dateTime) {
    return addHeader(name, (String) (dateTime != null ? dateTime.toString() : null));
}

From source file:com.monarchapis.client.rest.BaseClient.java

License:Open Source License

public T setHeader(String name, DateTime dateTime) {
    return addHeader(name, (String) (dateTime != null ? dateTime.toString() : null));
}

From source file:com.money.manager.ex.home.DatabaseMetadata.java

License:Open Source License

public void setRemoteLastChangedDate(DateTime value) {
    if (value == null) {
        this.remoteLastChangedDate = null;
    } else {/*  w  ww  . j  a  va 2 s . c  om*/
        this.remoteLastChangedDate = value.toString();
    }
}

From source file:com.money.manager.ex.sync.SyncManager.java

License:Open Source License

/**
 * Save the last modified datetime of the remote file into Settings for comparison during
 * the synchronization.//from  w  ww. j a  v a 2 s.  c o m
 * @param file file name
 */
void saveRemoteLastModifiedDate(String localPath, CloudMetaData file) {
    DateTime date = new DateTime(file.getModifiedAt());

    Timber.d("Saving last modification date %s for remote file %s", date.toString(), file);

    DatabaseMetadata currentDb = getDatabases().get(localPath);
    if (currentDb.remoteLastChangedDate == date.toString())
        return;

    currentDb.setRemoteLastChangedDate(date);
    getDatabases().save();
}

From source file:com.money.manager.ex.sync.SyncSchedulerBroadcastReceiver.java

License:Open Source License

private void startHeartbeat(Context context, AlarmManager alarmManager, PendingIntent pendingIntent) {
    SyncManager sync = new SyncManager(context);
    if (!sync.isSyncEnabled())
        return;/*w  w  w. j a va  2 s.c o m*/

    // get frequency in minutes.
    SyncPreferences preferences = new SyncPreferences(context);
    int minutes = preferences.getSyncInterval();
    // If the period is 0, do not schedule the alarm.
    if (minutes <= 0)
        return;

    DateTime now = DateTime.now();
    int secondsInMinute = 60;

    Timber.d("Scheduling synchronisation at: %s, repeat every %s minutes", now.toString(), minutes);

    // Schedule the alarm for synchronization. Run immediately and then in the given interval.
    alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, now.toDateTime().getMillis(),
            minutes * secondsInMinute * 1000, pendingIntent);
}

From source file:com.nesscomputing.mojo.numbers.DateField.java

License:Apache License

@Override
public String getPropertyValue() {
    final DateTimeZone timeZone = dateDefinition.getTimezone() == null ? DateTimeZone.getDefault()
            : DateTimeZone.forID(dateDefinition.getTimezone());

    DateTime date = getDateTime(valueProvider.getValue(), timeZone);

    if (date == null && dateDefinition.getValue() != null) {
        date = new DateTime(dateDefinition.getValue(), timeZone);
    }//from  w ww .j a v  a2s  .  c  o  m

    if (date == null) {
        date = new DateTime(timeZone);
    }

    final String format = dateDefinition.getFormat();

    if (format == null) {
        return date.toString();
    } else {
        final DateTimeFormatter formatter = DateTimeFormat.forPattern(format);
        return formatter.print(date);
    }
}

From source file:com.nextdoor.bender.Bender.java

License:Apache License

protected static void invokeS3Handler(String source_file) throws HandlerException {
    /*//www  .j  a va  2  s  .  c o  m
     * https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
     * https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html
     */
    String awsRegion = "us-east-1";
    String eventName = "s3:ObjectCreated:Put";
    String eventSource = "aws:s3";
    String eventVersion = "2.0";
    String s3ConfigurationId = "cli-id";
    String s3SchemaVersion = "1.0";

    S3BucketEntity s3BucketEntity = null;
    S3ObjectEntity s3ObjectEntity = null;

    /*
     * Make sure the URL was submitted properly
     *
     * Split the s3://bucket/object path into an S3BucketEntity and S3ObjectEntity object
     */
    try {
        AmazonS3URI s3URI = new AmazonS3URI(source_file);
        s3BucketEntity = new S3BucketEntity(s3URI.getBucket(), null, null);
        s3ObjectEntity = new S3ObjectEntity(s3URI.getKey(), 1L, null, null);
    } catch (IllegalArgumentException e) {
        logger.error("Invalid source_file URL supplied (" + source_file + "): " + e);
        System.exit(1);
    }

    /*
     * Override the AWS Region if its supplied
     */
    if (System.getenv("AWS_REGION") != null) {
        awsRegion = System.getenv("AWS_REGION");
    }

    /*
     * Set the arrival timestamp as the function run time.
     */
    DateTime eventTime = new DateTime().toDateTime();

    /*
     * Generate our context/handler objects.. we'll be populating them shortly.
     */
    TestContext ctx = getContext();
    S3Handler handler = new S3Handler();

    /*
     * Create a S3EventNotification event
     */
    S3Entity s3Entity = new S3Entity(s3ConfigurationId, s3BucketEntity, s3ObjectEntity, s3SchemaVersion);
    S3EventNotificationRecord rec = new S3EventNotificationRecord(awsRegion, eventName, eventSource,
            eventTime.toString(), eventVersion, null, null, s3Entity, null);
    List<S3EventNotificationRecord> notifications = new ArrayList<S3EventNotificationRecord>(2);
    notifications.add(rec);
    S3EventNotification s3event = new S3EventNotification(notifications);

    /*
     * Invoke handler
     */
    handler.handler(s3event, ctx);
    handler.shutdown();
}