All Downloads are FREE. Search and download functionalities are using the official Maven repository.

model.domain.util.date.DateGenerator Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package model.domain.util.date;

import java.time.ZoneId;
import java.util.Date;

/**
 * This class generates instantaneous point on the time-line in a {@link Date}
 * instance.
 * 
 * @author Jhonathan Camacho
 *
 */
public class DateGenerator {

	/**
	 * Returns an instantaneous point on the time-line in a {@link Date}
	 * instance. This method uses the 'America/Sao_Paulo' {@link ZoneId}.
	 * 
	 * @return an instantaneous point on the time-line in a {@link Date}
	 *         instance.
	 */
	public static final Date toInstant() {
		ZoneId saoPauloTimeZone = ZoneId.of("America/Sao_Paulo");
		Date date = Date.from(java.time.ZonedDateTime.now(saoPauloTimeZone).toInstant());

		return date;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy