Example usage for org.joda.time DateTimeZone UTC

List of usage examples for org.joda.time DateTimeZone UTC

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone UTC.

Prototype

DateTimeZone UTC

To view the source code for org.joda.time DateTimeZone UTC.

Click Source Link

Document

The time zone for Universal Coordinated Time

Usage

From source file:com.ecofactor.qa.automation.util.DateUtil.java

License:Open Source License

/**
 * Gets the uTC date.//from  w w  w. ja  va  2  s .  co m
 * @return the uTC date
 */
public static Date getUTCDate() {

    DateTime dt = new DateTime(DateTimeZone.UTC);
    Date utcDate = null;
    try {
        utcDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dt.toString("yyyy-MM-dd HH:mm:ss"));
    } catch (ParseException e) {
        e.printStackTrace();
    }
    LOGGER.debug("Current UTC Date " + formatToUTC(utcDate, DATE_FMT_FULL_TZ));
    return utcDate;
}

From source file:com.ecofactor.qa.automation.util.DateUtil.java

License:Open Source License

/**
 * Gets the uTC milliseconds./*from   ww  w.  ja va2s.  c om*/
 * @return the uTC milliseconds
 */
public static Long getUTCMilliseconds() {

    DateTime dt = new DateTime(DateTimeZone.UTC);
    Long utcMS = dt.toDate().getTime();
    LOGGER.debug("Current UTC ms " + utcMS);
    return utcMS;
}

From source file:com.ecofactor.qa.automation.util.DateUtil.java

License:Open Source License

/**
 * Gets the uTC day of week.// w w w. j  av  a 2s .c  o  m
 * @return the uTC day of week
 */
public static int getUTCDayOfWeek() {

    DateTime dt = new DateTime(DateTimeZone.UTC);
    int dayOfWeek = dt.getDayOfWeek();
    if (dayOfWeek < 7) {
        dayOfWeek += 1;
    } else if (dayOfWeek == 7) {
        dayOfWeek = 1;
    }
    return dayOfWeek;
}

From source file:com.effektif.workflow.api.types.DateType.java

License:Apache License

/**
 * Writes a {@link LocalDateTime} value using an ISO date format without milliseconds.
 *//*from  w ww . ja v  a 2s . com*/
@Override
public void writeBpmnValue(BpmnWriter w, Object value) {
    if (value != null && value instanceof LocalDateTime) {
        DateTime dateTime = ((LocalDateTime) value).toDateTime(DateTimeZone.UTC);
        w.writeStringAttributeEffektif("value", kind.formatter.print(dateTime));
    }
}

From source file:com.effektif.workflow.impl.json.types.LocalDateTimeStreamMapper.java

License:Apache License

@Override
public void write(LocalDateTime objectValue, JsonWriter jsonWriter) {
    jsonWriter.writeString(PRINTER.print(objectValue.toDateTime(DateTimeZone.UTC)));
}

From source file:com.effektif.workflow.impl.util.Time.java

License:Apache License

public static LocalDateTime now() {
    if (now != null) {
        return now;
    }//  ww  w. j  av a  2s .c  o  m
    return new LocalDateTime(DateTimeZone.UTC);
}

From source file:com.eldar.daos.mybatis.MyBatisContainerDao.java

License:Open Source License

@Override
public void save(Container container) {
    SqlSession session = sqlSessionFactory.openSession();
    try {//w w  w .  jav a 2 s  .  c  o m
        DateTime current = DateTime.now(DateTimeZone.UTC);
        container.setModifiedDate(current);
        for (CssClass cssClass : container.getCssClassList()) {
            cssClassDao.save(cssClass);
        }
        if (container.getId() > 0) {
            containerMapper.update(container);
        } else {
            container.setCreatedDate(current);
            containerMapper.insert(container);
        }
        for (CssClass cssClass : container.getCssClassList()) {
            cssClassDao.saveContainerRel(cssClass, container);
        }

    } catch (Exception ex) {
        logger.error("Error saving container", ex);
    } finally {
        session.commit();
        session.close();
    }
}

From source file:com.eldar.daos.mybatis.MyBatisCssClassDao.java

License:Open Source License

public void save(CssClass cssClass) {
    SqlSession session = sqlSessionFactory.openSession();
    try {// w ww .  j a  v a  2s .c o m
        DateTime current = DateTime.now(DateTimeZone.UTC);
        cssClass.setModifiedDate(current);
        if (cssClass.getId() > 0) {
            cssClassMapper.update(cssClass);
        } else {
            cssClass.setCreatedDate(current);
            cssClassMapper.insert(cssClass);
        }
    } catch (Exception ex) {
        logger.error("Error saving css class", ex);
    } finally {
        session.commit();
        session.close();
    }
}

From source file:com.eldar.daos.mybatis.MyBatisResourceDao.java

License:Open Source License

@Override
public void save(Resource resource) {
    SqlSession session = sqlSessionFactory.openSession();
    try {/*from w w w . j  a v a 2  s. c  o m*/
        DateTime dateTime = DateTime.now(DateTimeZone.UTC);
        resource.setModifiedDate(dateTime);
        if (resource.getId() == 0) {
            resource.setCreatedDate(dateTime);
            resourceMapper.insert(resource);
        } else {
            resourceMapper.update(resource);
        }
    } finally {
        session.commit();
        session.close();
    }
}

From source file:com.eldar.daos.mybatis.MyBatisResourceTypeDao.java

License:Open Source License

@Override
public void save(ResourceType resourceType) {
    SqlSession session = sqlSessionFactory.openSession();
    try {/*from   w ww  .  ja  v a  2  s  .  c o m*/
        DateTime dateTime = DateTime.now(DateTimeZone.UTC);
        resourceType.setModifiedDate(dateTime);
        if (resourceType.getId() == 0) {
            resourceType.setCreatedDate(dateTime);
            resourceTypeMapper.insert(resourceType);
        } else {
            resourceTypeMapper.update(resourceType);
        }
    } finally {
        session.commit();
        session.close();
    }
}