public class SomUtcTime
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SomUtcTime.TimeStringType |
Constructor and Description |
---|
SomUtcTime()
Create a new object representing the current date/time in the local
timezone.
|
SomUtcTime(java.util.Date date)
Create a new object representing a specific date/time in the local
timezone.
|
SomUtcTime(int seconds)
Create a new SomUtcTime, setting it from a seconds value
|
SomUtcTime(java.lang.String utcstring)
Deprecated.
|
SomUtcTime(java.lang.String utcstring,
SomUtcTime.TimeStringType type)
Create a new SomUtcTime object, setting its values from the utc or generalized
time string passed in
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
getDate()
Return a Java Date object representing the UTCtime.
|
static SomUtcTime |
getEmptyUTCtime()
Factory method to return an "empty" UTCtime.
|
SomUtcTime |
getOffsetTime(java.lang.Integer offset)
Return SomUtcTime object with value shifted by given offset
|
void |
increment(int seconds)
Increment the value of a SomUtcTime object by a number of seconds
|
boolean |
isEmpty()
Determine whether this object represents an empty date.
|
static void |
main(java.lang.String[] args)
Main method for unit testing this class.
|
java.lang.String |
offsetFrom(java.util.Date date)
Get a string indicating the days, hours, miunutes and seconds offset for
this SomUtcTime value from a specified Date
|
long |
offsetMilliSecondsFrom(java.util.Date date)
Get a seconds offset for this SomUtcTime value from a specified Date
|
java.lang.Integer |
offsetMinutesFrom(java.util.Date date)
Get a minutes offset for this SomUtcTime value from a specified Date
|
java.lang.Integer |
offsetSecondsFrom(java.util.Date date)
Get a seconds offset for this SomUtcTime value from a specified Date
|
java.lang.String |
toString()
Make printable version of the UTCtime.
|
java.lang.String |
toUtcString()
Make UTC string version of the UTCtime.
|
java.lang.String |
toUtcString(SomUtcTime.TimeStringType type)
Make UTC string version of the UTCtime.
|
public SomUtcTime(java.util.Date date)
date
- the time/date to usepublic SomUtcTime(java.lang.String utcstring)
utcstring
- time string to parsepublic SomUtcTime(java.lang.String utcstring, SomUtcTime.TimeStringType type) throws SomInvalidTimeStringException
utcstring
- time string to parsetype
- indicates if is UTCTime or GeneralizedSomInvalidTimeStringException
- if the time string is invalidpublic SomUtcTime(int seconds)
seconds
- value for use in initializationpublic SomUtcTime()
public java.lang.Integer offsetSecondsFrom(java.util.Date date)
date
- Date to get difference frompublic long offsetMilliSecondsFrom(java.util.Date date)
date
- Date to get difference frompublic java.lang.Integer offsetMinutesFrom(java.util.Date date)
date
- Date to get difference frompublic java.lang.String offsetFrom(java.util.Date date)
date
- Date to get difference frompublic void increment(int seconds)
seconds
- number to increment bypublic static SomUtcTime getEmptyUTCtime()
getDate()
on an "empty" UTCtime object will return null.public boolean isEmpty()
public java.util.Date getDate()
public SomUtcTime getOffsetTime(java.lang.Integer offset)
offset
- in seconds used for shiftingpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toUtcString()
public java.lang.String toUtcString(SomUtcTime.TimeStringType type)
type
- time string type to returnpublic static void main(java.lang.String[] args)
java com.isode.dconsole.UTCtime (current timezone) java -Duser.timezone=America/New_York com.isode.dconsole.UTCtime java -Duser.timezone=Australia/Broken_Hill com.isode.dconsole.UTCtimeSee www.worldtimeserver.com to confirm the results
args
- notusedVersion: 18.0v6-0
Copyright (c) 2017-2020 Isode