Package com.saperion.util
Class SaDateHelper
java.lang.Object
com.saperion.util.SaDateHelper
Helper class to convert and parse java date and calendar objects.
- Author:
- rbo
-
Method Summary
Modifier and TypeMethodDescriptionstatic Date
convertLocalToUTC
(Date date) static Calendar
getCalendar
(Date date) Get calendar from date.static String
getDateString
(Calendar cal) Creates a ISO string from calendar.static String
getDateString
(Date date) Creates a ISO date string.static Date
static Calendar
parseCalendar
(String isoString) Parse an ISO string.static Date
Parse an ISO string.
-
Method Details
-
getCalendar
Get calendar from date.- Parameters:
date
- Date- Returns:
- Calendar
-
getDateString
Creates a ISO date string.- Parameters:
date
- Date- Returns:
- ISO date
-
getDateString
Creates a ISO string from calendar.- Parameters:
cal
- Calendar- Returns:
- ISO string
-
parseCalendar
Parse an ISO string.- Parameters:
isoString
- ISO string- Returns:
- Calendar
-
parseDate
Parse an ISO string.- Parameters:
isoString
- ISO string- Returns:
- Date
-
getUTCDateTime
- Returns:
- a new
Date
containing the current date and time in UTC timezone
-
convertLocalToUTC
- Parameters:
date
- date in local timezone to convert to UTC- Returns:
- converted date in UTC time zone
-