public final class DateTools
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ALT_ZVI |
static long |
ALT_ZVI_EPOCH |
static int |
COBOL |
static long |
COBOL_EPOCH |
static java.lang.String |
FILENAME_FORMAT
Human readable timestamp filename string
|
static java.lang.String |
ISO8601_FORMAT
ISO 8601 date output formatter without milliseconds.
|
static java.lang.String |
ISO8601_FORMAT_MS
ISO 8601 date output formatter with milliseconds.
|
static int |
MICROSOFT |
static long |
MICROSOFT_EPOCH |
static java.lang.String |
TIMESTAMP_FORMAT
Human readable timestamp string
|
static int |
UNIX
Timestamp formats.
|
static long |
UNIX_EPOCH
Milliseconds until UNIX epoch.
|
static int |
ZVI |
static long |
ZVI_EPOCH |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertDate(long stamp,
int format)
Converts the given timestamp into an ISO8601 date.
|
static java.lang.String |
convertDate(long stamp,
int format,
java.lang.String outputFormat)
Converts the given timestamp into a date string with the given format.
|
static java.lang.String |
convertDate(long stamp,
int format,
java.lang.String outputFormat,
boolean correctTimeZoneForGMT)
Converts the given timestamp into a date string with the given format.
|
static java.lang.String |
formatDate(java.lang.String date,
java.lang.String format)
Formats the given date as an ISO 8601 date.
|
static java.lang.String |
formatDate(java.lang.String date,
java.lang.String[] formats)
Formats the given date as an ISO 8601 date.
|
static java.lang.String |
formatDate(java.lang.String date,
java.lang.String[] formats,
boolean lenient)
Formats the given date as an ISO 8601 date.
|
static java.lang.String |
formatDate(java.lang.String date,
java.lang.String format,
boolean lenient)
Formats the given date as an ISO 8601 date.
|
static java.lang.String |
getFileTimestamp()
Returns a timestamp for the current timezone in a format suitable
for a filename in a locale-independent format
("YYYY-MM-DD_HH-MM-SS")
|
static long |
getMillisFromTicks(long hi,
long lo)
Converts from two-word tick representation to milliseconds.
|
static long |
getTime(java.lang.String date,
java.lang.String format)
Converts a string date in the given format to a long timestamp
(in Unix format: milliseconds since January 1, 1970).
|
static java.lang.String |
getTimestamp()
Returns a timestamp for the current timezone in a
human-readable locale-independent format ("YYYY-MM-DD HH:MM:SS")
|
public static final int UNIX
public static final int COBOL
public static final int MICROSOFT
public static final int ZVI
public static final int ALT_ZVI
public static final long UNIX_EPOCH
public static final long COBOL_EPOCH
public static final long MICROSOFT_EPOCH
public static final long ZVI_EPOCH
public static final long ALT_ZVI_EPOCH
public static final java.lang.String ISO8601_FORMAT_MS
public static final java.lang.String ISO8601_FORMAT
public static final java.lang.String TIMESTAMP_FORMAT
public static final java.lang.String FILENAME_FORMAT
public static long getMillisFromTicks(long hi, long lo)
public static java.lang.String convertDate(long stamp, int format)
public static java.lang.String convertDate(long stamp, int format, java.lang.String outputFormat)
public static java.lang.String convertDate(long stamp, int format, java.lang.String outputFormat, boolean correctTimeZoneForGMT)
public static java.lang.String formatDate(java.lang.String date, java.lang.String format)
formatDate(String, String, boolean)
, with the
'lenient' flag set to false.date
- The date to format as ISO 8601.format
- The date's input format.public static java.lang.String formatDate(java.lang.String date, java.lang.String format, boolean lenient)
date
- The date to format as ISO 8601.format
- The date's input format.lenient
- Whether or not to leniently parse the date.public static java.lang.String formatDate(java.lang.String date, java.lang.String[] formats)
formatDate(String, String[], boolean)
, with the
'lenient' flag set to false.date
- The date to format as ISO 8601.formats
- The date's possible input formats.public static java.lang.String formatDate(java.lang.String date, java.lang.String[] formats, boolean lenient)
date
- The date to format as ISO 8601.formats
- The date's possible input formats.lenient
- Whether or not to leniently parse the date.public static long getTime(java.lang.String date, java.lang.String format)
public static java.lang.String getTimestamp()
public static java.lang.String getFileTimestamp()
Copyright © 2014 Open Microscopy Environment