Example usage for java.util GregorianCalendar from

List of usage examples for java.util GregorianCalendar from

Introduction

In this page you can find the example usage for java.util GregorianCalendar from.

Prototype

public static GregorianCalendar from(ZonedDateTime zdt) 

Source Link

Document

Obtains an instance of GregorianCalendar with the default locale from a ZonedDateTime object.

Usage

From source file:ru.anr.base.BaseParent.java

/**
 * Transforms the given zoned date-time object to a gregorian calendar
 * //from  w w  w.  j a  v a2 s  .c o  m
 * @param dateTime
 *            A date-time object
 * @return A calendar object
 */
public static Calendar calendar(ZonedDateTime dateTime) {

    return GregorianCalendar.from(dateTime);
}

From source file:ru.anr.base.domain.BaseEntity.java

/**
 * Performing pre-create actions
 */
@PrePersist
public void prePersist() {

    setCreated(GregorianCalendar.from(now()));

}

From source file:ru.anr.base.domain.BaseEntity.java

/**
 * Performing pre-update actions
 */
@PreUpdate
public void preUpdate() {

    setModified(GregorianCalendar.from(now()));
}

From source file:ru.anr.base.domain.BaseEntity.java

/**
 * Changing a state of this object/*w w w. j a  v  a 2  s.c o  m*/
 * 
 * @param newState
 *            New state name
 * @return Old state (being changed)
 */
public String changeState(String newState) {

    String oldState = getState();

    setState(newState);
    setStateChanged(GregorianCalendar.from(now()));

    return oldState;
}