public final class DateTools extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ALT_ZVI |
static long |
ALT_ZVI_EPOCH |
static int |
COBOL |
static long |
COBOL_EPOCH |
static String |
FILENAME_FORMAT
Human readable timestamp filename string
|
static String |
ISO8601_FORMAT_MS
ISO 8601 date output format with milliseconds.
|
static String |
ISO8601_FORMAT_S
ISO 8601 date output format without milliseconds.
|
static int |
MICROSOFT |
static long |
MICROSOFT_EPOCH |
static 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 String |
convertDate(long stamp,
int format)
Converts the given timestamp into an ISO8601 date.
|
static String |
convertDate(long stamp,
int format,
String outputFormat)
Converts the given timestamp into a date string with the given format.
|
static String |
convertDate(long stamp,
int format,
String outputFormat,
boolean correctTimeZoneForGMT)
Converts the given timestamp into a date string with the given format.
|
static String |
formatDate(String date,
String format)
Formats the given date as an ISO 8601 date.
|
static String |
formatDate(String date,
String[] formats)
Formats the given date as an ISO 8601 date.
|
static String |
formatDate(String date,
String[] formats,
boolean lenient)
Formats the given date as an ISO 8601 date.
|
static String |
formatDate(String date,
String format,
boolean lenient)
Formats the given date as an ISO 8601 date.
|
static 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(String date,
String format)
Converts a string date in the given format to a long timestamp
(in Unix format: milliseconds since January 1, 1970).
|
static 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 String ISO8601_FORMAT_MS
public static final String ISO8601_FORMAT_S
public static final String TIMESTAMP_FORMAT
public static final String FILENAME_FORMAT
public static long getMillisFromTicks(long hi, long lo)
public static String convertDate(long stamp, int format)
public static String convertDate(long stamp, int format, String outputFormat)
public static String convertDate(long stamp, int format, String outputFormat, boolean correctTimeZoneForGMT)
public static String formatDate(String date, 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 String formatDate(String date, 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 String formatDate(String date, 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 String formatDate(String date, 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(String date, String format)
public static String getTimestamp()
public static String getFileTimestamp()
Copyright © 2014 Open Microscopy Environment