
org.gnode.nix.internal.DateUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nix-linux-x86_64 Show documentation
Show all versions of nix-linux-x86_64 Show documentation
Java bindings for NIX library
The newest version!
package org.gnode.nix.internal;
import java.util.Date;
/**
* DateUtils
* This class contains functions for date conversions.
*/
public class DateUtils {
/**
* Convert seconds to appropriate date
*
* Required for functions that use time_t
*
* @param seconds seconds to be converted
* @return date object
*/
public static Date convertSecondsToDate(long seconds) {
// convert to milliseconds by multiplying by 1000
// DateTime expects input in milliseconds
seconds *= 1000L;
return new Date(seconds);
}
/**
* Convert date object to seconds
*
* Required for functions that use time_t
*
* @param dateTime date to be converted
* @return seconds
*/
public static long convertDateToSeconds(Date dateTime) {
long seconds = dateTime.getTime() / 1000;
return seconds;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy