Package org.matomo.java.tracking
Class MatomoDate
java.lang.Object
org.matomo.java.tracking.MatomoDate
- Direct Known Subclasses:
PiwikDate
A datetime object that will return the datetime in the format
yyyy-MM-dd hh:mm:ss.- Author:
- brettcsorba
-
Constructor Summary
ConstructorsConstructorDescriptionAllocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.MatomoDate(long epochMilli) Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. -
Method Summary
Modifier and TypeMethodDescriptionlonggetTime()Converts this datetime to the number of milliseconds from the epoch of 1970-01-01T00:00:00Z.voidsetTimeZone(ZoneId zone) Sets the time zone of the String that will be returned bytoString().toString()Converts this MatomoDate object to a String of the form:
yyyy-MM-dd hh:mm:ss.
-
Constructor Details
-
MatomoDate
public MatomoDate()Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond. -
MatomoDate
public MatomoDate(long epochMilli) Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.- Parameters:
epochMilli- the milliseconds since January 1, 1970, 00:00:00 GMT.
-
-
Method Details
-
setTimeZone
Sets the time zone of the String that will be returned bytoString(). Defaults to UTC.- Parameters:
zone- the TimeZone to set
-
toString
Converts this MatomoDate object to a String of the form:
yyyy-MM-dd hh:mm:ss. -
getTime
public long getTime()Converts this datetime to the number of milliseconds from the epoch of 1970-01-01T00:00:00Z.- Returns:
- the number of milliseconds since the epoch of 1970-01-01T00:00:00Z
- Throws:
ArithmeticException- if numeric overflow occurs
-