|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.common.pim.model.utility.TimeUtils
public class TimeUtils
Field Summary | |
---|---|
static java.lang.String |
PATTERN_LOCALTIME
|
static int |
PATTERN_LOCALTIME_LENGTH
|
static java.lang.String |
PATTERN_LOCALTIME_WOT
|
static int |
PATTERN_LOCALTIME_WOT_LENGTH
|
static java.lang.String |
PATTERN_UTC
|
static int |
PATTERN_UTC_LENGTH
|
static java.lang.String |
PATTERN_UTC_WOZ
|
static int |
PATTERN_UTC_WOZ_LENGTH
|
static java.lang.String |
PATTERN_UTC_WSEP
|
static int |
PATTERN_UTC_WSEP_LENGTH
|
static java.lang.String |
PATTERN_YYYY_MM_DD
|
static java.lang.String |
PATTERN_YYYY_MM_DD_HH_MM_SS
|
static int |
PATTERN_YYYY_MM_DD_HH_MM_SS_LENGTH
|
static int |
PATTERN_YYYY_MM_DD_LENGTH
|
static java.lang.String |
PATTERN_YYYYMMDD
|
static int |
PATTERN_YYYYMMDD_LENGTH
|
static long |
SECOND_IN_A_DAY
|
static java.util.TimeZone |
TIMEZONE_UTC
|
Constructor Summary | |
---|---|
TimeUtils()
|
Method Summary | |
---|---|
static java.lang.String |
convertDateFromInDayFormat(java.lang.String stringDate,
java.lang.String hhmmss)
Convert date from yyyy-MM-dd format or from yyyyMMdd format into yyyyMMdd'T'HHmmss format. |
static java.lang.String |
convertDateFromInDayFormat(java.lang.String stringDate,
java.lang.String hhmmss,
boolean inUtc)
Convert date from yyyy-MM-dd or yyyyMMdd format into format yyyyMMdd'T'HHmmss. |
static java.lang.String |
convertDateFromTo(java.lang.String stringDate,
java.lang.String patternToUse)
Convert date from the input date format into specificated format. |
static java.lang.String |
convertDateFromTo(java.lang.String stringDate,
java.lang.String patternToUse,
java.util.TimeZone timezoneIn,
java.util.TimeZone timezoneOut)
Convert date from the input date format into specificated format. |
static java.lang.String |
convertDateTo(java.util.Date date,
java.lang.String patternToUse)
Convert the given date in the given format. |
static java.lang.String |
convertDateTo(java.util.Date date,
java.util.TimeZone timeZone,
java.lang.String patternToUse)
Convert the given date in the given format. |
static java.lang.String |
convertLocalDateToUTC(java.lang.String sDate,
java.util.TimeZone timezone)
Convert the given date following this roles: if the given date is in UTC no conversion is required if the given date is not in UTC and the given timezone isn't null, the date is localizated with the timezone and then it's converted in UTC. the returned string is always in UTC if the given timezone is null and the date isn't in UTC, the date is localizated with the default timezone the given date can be in one beetwen the following formats: yyyyMMdd'T'HHmmss'Z', yyyyMMdd'T'HHmmss
|
static java.lang.String |
convertUTCDateToLocal(java.lang.String sDate,
java.util.TimeZone timezone)
Convert the given date following this roles: if the given timezone isn't null, the date is localizated with the timezone and then reformatted in yyyyMMdd'T'HHmmss'Z' .
the returned string is always in this format yyyyMMdd'T'HHmmss'Z'
if the given timezone is null the date is not changed
|
static java.lang.String |
getAlarmInterval(int minutes)
Converts a signed number of minutes into an ISO 8601 interval. |
static int |
getAlarmInterval(java.lang.String interval)
Calculate the minutes into int format in the case in which the input is into ISO 8601 format; else return the interval |
static int |
getAlarmMinutes(java.lang.String dtStart,
java.lang.String dtAlarm,
java.util.logging.Logger logger)
If dtStart and date into Alarm aren't empty, computes the minutes before to start the reminder as dtStart - date alarm = minutes and return it. |
static java.lang.String |
getDateFormat(java.lang.String date)
Get the date pattern |
static java.lang.String |
getDTEnd(java.lang.String dtStart,
java.lang.String duration,
java.lang.String dtEnd,
java.util.logging.Logger logger)
If dtStart and duration aren't empty, computes the dtEnd as dtStart + duration and return it. |
static java.lang.String |
getIso8601Duration(java.lang.String minutes)
Returns the given minutes in iso 8601 duration format |
static long |
getMidnightTime(java.lang.String dateTime)
Gets the timestamp of the midnight at a given date (i.e., the midnight at the beginning of that day). |
static int |
getMinutes(java.lang.String iso8601Duration)
Returns the given Iso 8601 duration in minutes |
static boolean |
isAllDayEvent(java.lang.String dateStart,
java.lang.String dateEnd)
Checks if the given dates are relative to an all day event. |
static boolean |
isInAllDayFormat(java.lang.String date)
Check if the date is into format yyyyMMdd or yyyy-MM-dd. |
static java.lang.String |
localTimeToUTC(java.lang.String actualTime,
java.util.logging.Logger logger)
Set a string date from dd/MM/yyyy HH:mm:ss according to default local timezone into a UTC date pattern yyyyMMdd'T'HHmmss'Z' |
static java.lang.String |
normalizeToISO8601(java.lang.String sDate,
java.util.TimeZone tz)
Convert the given sDate in iso 8601 format. |
static java.lang.String |
rollOneDay(java.lang.String ymd,
boolean after)
Gets the day before or after a given argument. |
static java.lang.String |
UTCToLocalTime(java.lang.String UTCFormat,
java.util.logging.Logger logger)
Set a string date from UTC format (yyyyMMdd'T'HHmmss'Z') into a format dd/MM/yyyy HH:mm:ss according to default local timezone. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PATTERN_YYYYMMDD
public static final int PATTERN_YYYYMMDD_LENGTH
public static final java.lang.String PATTERN_YYYY_MM_DD
public static final int PATTERN_YYYY_MM_DD_LENGTH
public static final java.lang.String PATTERN_UTC
public static final int PATTERN_UTC_LENGTH
public static final java.lang.String PATTERN_UTC_WOZ
public static final int PATTERN_UTC_WOZ_LENGTH
public static final java.lang.String PATTERN_UTC_WSEP
public static final int PATTERN_UTC_WSEP_LENGTH
public static final java.lang.String PATTERN_LOCALTIME
public static final int PATTERN_LOCALTIME_LENGTH
public static final java.lang.String PATTERN_LOCALTIME_WOT
public static final int PATTERN_LOCALTIME_WOT_LENGTH
public static final java.lang.String PATTERN_YYYY_MM_DD_HH_MM_SS
public static final int PATTERN_YYYY_MM_DD_HH_MM_SS_LENGTH
public static final long SECOND_IN_A_DAY
public static final java.util.TimeZone TIMEZONE_UTC
Constructor Detail |
---|
public TimeUtils()
Method Detail |
---|
public static java.lang.String UTCToLocalTime(java.lang.String UTCFormat, java.util.logging.Logger logger)
UTCFormat
- the input date in UTC format
public static java.lang.String rollOneDay(java.lang.String ymd, boolean after)
ymd
- a String representing a date in an all-day formatafter
- true if the day after is needed, false if it's the day
before
public static java.lang.String localTimeToUTC(java.lang.String actualTime, java.util.logging.Logger logger)
actualTime
- the date into default local timezone
public static java.lang.String convertLocalDateToUTC(java.lang.String sDate, java.util.TimeZone timezone) throws java.lang.Exception
yyyyMMdd'T'HHmmss'Z', yyyyMMdd'T'HHmmss
sDate
- the given string date to converttimezone
- TimeZone
java.lang.Exception
public static java.lang.String convertUTCDateToLocal(java.lang.String sDate, java.util.TimeZone timezone) throws java.lang.Exception
yyyyMMdd'T'HHmmss'Z'
.yyyyMMdd'T'HHmmss'Z'
sDate
- the given string date to converttimezone
- TimeZone
java.lang.Exception
public static java.lang.String normalizeToISO8601(java.lang.String sDate, java.util.TimeZone tz)
The formats accepted are:
sDate
- String
public static int getMinutes(java.lang.String iso8601Duration)
iso8601Duration
- String
public static java.lang.String getIso8601Duration(java.lang.String minutes)
minutes
- String
public static java.lang.String getDTEnd(java.lang.String dtStart, java.lang.String duration, java.lang.String dtEnd, java.util.logging.Logger logger)
dtStart
- String Date to start the eventduration
- StringdtEnd
- String
public static int getAlarmMinutes(java.lang.String dtStart, java.lang.String dtAlarm, java.util.logging.Logger logger)
dtStart
- StringdtAlarm
- String
public static int getAlarmInterval(java.lang.String interval)
interval
- the interval in which the reminder has to be repeated
public static java.lang.String getAlarmInterval(int minutes)
minutes
-
public static boolean isInAllDayFormat(java.lang.String date)
date
- The date to check (Usually this is the start date event)
public static java.lang.String convertDateFromInDayFormat(java.lang.String stringDate, java.lang.String hhmmss) throws java.text.ParseException
stringDate
- the date to converthhmmss
- the hours, minutes, seconds to add
java.text.ParseException
public static java.lang.String convertDateFromInDayFormat(java.lang.String stringDate, java.lang.String hhmmss, boolean inUtc) throws java.text.ParseException
stringDate
- the date to converthhmmss
- the hours, minutes, seconds to add
java.text.ParseException
public static java.lang.String convertDateFromTo(java.lang.String stringDate, java.lang.String patternToUse) throws java.text.ParseException
patternToUse
- the pattern to usestringDate
- the date to convert
java.text.ParseException
public static java.lang.String convertDateFromTo(java.lang.String stringDate, java.lang.String patternToUse, java.util.TimeZone timezoneIn, java.util.TimeZone timezoneOut) throws java.text.ParseException
stringDate
- the date to convertpatternToUse
- the required pattern for the output datetimezoneIn
- the timezone to apply to the given datetimezoneOut
- the timezone to apply on the output date
java.text.ParseException
- if an error occurspublic static java.lang.String convertDateTo(java.util.Date date, java.lang.String patternToUse) throws java.text.ParseException
patternToUse
- the pattern of the output datedate
- the date to convert
java.text.ParseException
- if an error occurspublic static java.lang.String convertDateTo(java.util.Date date, java.util.TimeZone timeZone, java.lang.String patternToUse) throws java.text.ParseException
timeZone
- the time zone to usepatternToUse
- the pattern of the output datedate
- the date to convert
java.text.ParseException
public static java.lang.String getDateFormat(java.lang.String date)
date
- the date to get the format
public static boolean isAllDayEvent(java.lang.String dateStart, java.lang.String dateEnd)
T000000Z
and the end date ends with
T235959Z
or T235900Z
or T240000Z
dateStart
- StringdateEnd
- String
public static long getMidnightTime(java.lang.String dateTime) throws java.text.ParseException
dateTime
- a date (and, optionally, a time) in the ISO 8601 format
java.text.ParseException
- if dateTime has a wrong format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |