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

javastrava.util.StravaDateUtils Maven / Gradle / Ivy

The newest version!
package javastrava.util;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * @author Dan Shannon
 *
 */
public class StravaDateUtils {

	/**
	 * @param date
	 *            Date for which seconds since the epoch date is to be calculated
	 * @return Number of seconds after the unix epoch date equivalent to the given date
	 */
	public static Integer secondsSinceUnixEpoch(final LocalDateTime date) {
		if (date == null) {
			return null;
		}
		final Long timeInSeconds = Long.valueOf(date.toEpochSecond(ZoneOffset.UTC));
		return Integer.valueOf(timeInSeconds.intValue());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy