Class UtcTimeUtilities
- java.lang.Object
-
- org.hortonmachine.gears.utils.time.UtcTimeUtilities
-
public class UtcTimeUtilities extends Object
An utility class for time related issues, all in UTC timezone.This class is supposed to handle only the string format YYYY-MM-DD HH:MM:SS. If not explicitly defined, that format, with or without seconds, is used.
- Since:
- 0.7.0
- Author:
- Andrea Antonello (www.hydrologis.com)
-
-
Constructor Summary
Constructors Constructor Description UtcTimeUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.joda.time.DateTimefromStringWithMinutes(String dateTimeString)GetDateTimefrom date string of format: YYYY-MM-DD HH:MM.static org.joda.time.DateTimefromStringWithSeconds(String dateTimeString)GetDateTimefrom date string of format: YYYY-MM-DD HH:MM:SS.static org.joda.time.DateTimenewDateTime()Getter for the current time.static StringquickToString(long unixEpoch)Quick long to timestamp string formatter, UTC.static StringquickToStringLocal(long unixEpoch)Quick long to timestamp string formatter.static StringtoStringWithMinutes(org.joda.time.DateTime dateTime)Get String of format: YYYY-MM-DD HH:MM fromDateTime.static StringtoStringWithSeconds(org.joda.time.DateTime dateTime)Get String of format: YYYY-MM-DD HH:MM:SS fromDateTime.
-
-
-
Method Detail
-
newDateTime
public static org.joda.time.DateTime newDateTime()
Getter for the current time.- Returns:
- the current time in utc.
-
fromStringWithSeconds
public static org.joda.time.DateTime fromStringWithSeconds(String dateTimeString)
GetDateTimefrom date string of format: YYYY-MM-DD HH:MM:SS.- Parameters:
dateTimeString- the date string.- Returns:
- the parsed datetime.
-
fromStringWithMinutes
public static org.joda.time.DateTime fromStringWithMinutes(String dateTimeString)
GetDateTimefrom date string of format: YYYY-MM-DD HH:MM.- Parameters:
dateTimeString- the date string.- Returns:
- the parsed datetime.
-
toStringWithSeconds
public static String toStringWithSeconds(org.joda.time.DateTime dateTime)
Get String of format: YYYY-MM-DD HH:MM:SS fromDateTime.- Parameters:
dateTime- theDateTime.- Returns:
- the date string.
-
toStringWithMinutes
public static String toStringWithMinutes(org.joda.time.DateTime dateTime)
Get String of format: YYYY-MM-DD HH:MM fromDateTime.- Parameters:
dateTime- theDateTime.- Returns:
- the date string.
-
quickToString
public static String quickToString(long unixEpoch)
Quick long to timestamp string formatter, UTC.- Parameters:
unixEpoch- the unix epoch to convert.- Returns:
- the timestamp string as yyyy-MM-dd HH:mm:ss
-
quickToStringLocal
public static String quickToStringLocal(long unixEpoch)
Quick long to timestamp string formatter.- Parameters:
unixEpoch- the unix epoch to convert.- Returns:
- the timestamp string as yyyy-MM-dd HH:mm:ss
-
-