|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opcfoundation.ua.builtintypes.DateTime
public class DateTime
OPC UA DateTime. The OPC UA dateTime is defined as follows (OPCUA Part 3) 7.29 UtcTime This primitive DataType is used to define Coordinated Universal Time (UTC) values. All time values conveyed between servers and clients in OPC UA are UTC values. Clients must provide any conversions between UTC and local time. This DataType is represented as a 64-bit signed integer which represents the number of 100 nanosecond intervals since January 1, 1601. [UA Part 6] defines details about this DataType.
| Field Summary | |
|---|---|
static String |
DEFAULT_STR_FORMAT
Constant DEFAULT_STR_FORMAT="%TD %TT.%07d %TZ" |
static NodeId |
ID
Constant ID |
static String |
ISO_8601_STR_FORMAT
Constant ISO_8601_STR_FORMAT="%TF %TT.%07d %TZ" |
static DateTime |
MAX_VALUE
Constant MAX_VALUE |
static DateTime |
MIN_VALUE
Constant MIN_VALUE |
static long |
OffsetToGregorianCalendarZero
Constant OffsetToGregorianCalendarZero=116444736000000000L |
| Constructor Summary | |
|---|---|
DateTime()
Constructs a new DateTime value, initializing it with the current UTC time. |
|
DateTime(Calendar value)
Constructs a new DateTime value, is initializing it with a Calendar value. |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
Constructs a new DateTime value, initializing it with the given time value (in UTC timezone). |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int nanosecond)
Constructs a new DateTime value, initializing it with the given time value (in UTC timezone). |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int nanosecond,
TimeZone timeZone)
Constructs a new DateTime value, initializing it with the given time value (in the defined timezone). |
|
DateTime(long value)
Constructs a new DateTime value, initializing it with an OPC UA time value with a resolution of 100 nanoseconds. |
|
| Method Summary | |
|---|---|
int |
compareTo(DateTime o)
|
static DateTime |
currentTime()
currentTime. |
boolean |
equals(Object obj)
|
static DateTime |
fromMillis(long value)
Create a new DateTime instance from standard Java milliseconds since the beginning of epoch, January 1, 1970 UTC. |
GregorianCalendar |
getCalendar(TimeZone timezone)
Return the time as a calendar value. |
GregorianCalendar |
getLocalCalendar()
getLocalCalendar. |
long |
getMilliSeconds()
Get milliseconds between the time and midnight, January 1, 1601 UTC. |
static String |
getStrFormat()
Get the format used for toString() |
long |
getTimeInMillis()
Get standard Java milliseconds between the time and midnight, January 1, 1970 UTC. |
GregorianCalendar |
getUtcCalendar()
getUtcCalendar. |
long |
getValue()
Get 1/10 microseconds (1 unit = 100 nanoseconds) between the time and midnight, January 1, 1601 UTC. |
int |
hashCode()
|
static boolean |
isUseLocalTimeInToString()
If this is true, then DateTime.toString should print local timestamps and Utc if this is false. |
static DateTime |
parseDateTime(String s)
Parse a DateTime value from a string. |
static void |
setStrFormat(String strFormat)
Set the format used for toString() |
static void |
setUseLocalTimeInToString(boolean useLocalTimeInToString)
If this is true, then DateTime.toString should print local timestamps and Utc if this is false. |
String |
toString()
toString. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static String DEFAULT_STR_FORMAT
DEFAULT_STR_FORMAT="%TD %TT.%07d %TZ"
public static String ISO_8601_STR_FORMAT
ISO_8601_STR_FORMAT="%TF %TT.%07d %TZ"
public static final NodeId ID
ID
public static final long OffsetToGregorianCalendarZero
OffsetToGregorianCalendarZero=116444736000000000L
public static final DateTime MIN_VALUE
MIN_VALUE
public static final DateTime MAX_VALUE
MAX_VALUE
| Constructor Detail |
|---|
public DateTime()
public DateTime(long value)
value - a long.public DateTime(Calendar value)
value - a Calendar object.
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int nanosecond,
TimeZone timeZone)
Creates a GregorianCalendar using the parameters year..second; sets the TimeZone and adds nanoSeconds.
Note: that month is 0-based, and the values correspond to the constants, Calendar.JANUARY, etc.
year - a int.month - a int.day - a int.hour - a int.minute - a int.second - a int.nanosecond - a int.timeZone - a TimeZone object.
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int nanosecond)
Creates a GregorianCalendar using the parameters year..second and adds nanoSeconds.
Note: that month is 0-based, and the values correspond to the constants, Calendar.JANUARY, etc.
year - a int.month - a int.day - a int.hour - a int.minute - a int.second - a int.nanosecond - a int.
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
Creates a GregorianCalendar using the parameters year..second.
Note: that month is 0-based, and the values correspond to the constants, Calendar.JANUARY, etc.
year - a int.month - a int.day - a int.hour - a int.minute - a int.second - a int.| Method Detail |
|---|
public long getValue()
public long getMilliSeconds()
public long getTimeInMillis()
public String toString()
toString.
toString in class ObjectString object.public GregorianCalendar getUtcCalendar()
getUtcCalendar.
public GregorianCalendar getLocalCalendar()
getLocalCalendar.
public GregorianCalendar getCalendar(TimeZone timezone)
timezone - The desired TimeZone for the calendar
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic int compareTo(DateTime o)
compareTo in interface Comparable<DateTime>public static DateTime currentTime()
currentTime.
public static DateTime parseDateTime(String s)
throws ParseException
All DateTime values shall be encoded as UTC times or with the time zone explicitly specified.Correct:
2002-10-10T00:00:00+05:00
2002-10-09T19:00:00ZIncorrect:
2002-10-09T19:00:00
s - the string to parse
ParseException - if the DateTime cannot be parsed from spublic static DateTime fromMillis(long value)
value - a long.
DateTime object.public static String getStrFormat()
public static void setStrFormat(String strFormat)
strFormat - new formatpublic static boolean isUseLocalTimeInToString()
public static void setUseLocalTimeInToString(boolean useLocalTimeInToString)
useLocalTimeInToString - a boolean.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||