public final class DateFormats extends Object
Modifier and Type | Method and Description |
---|---|
static String |
formatIso8601(Date date)
Return an ISO-8601-formatted string with millisecond precision representing the
specified
date . |
static String |
formatIso8601(Date date,
boolean includeMillis)
Returns an ISO-8601-formatted string with optional millisecond precision for the specified
date . |
static Date |
parseIso8601Date(String s)
Parse the specified ISO-8601-formatted date string and return the corresponding
Date instance. |
public static String formatIso8601(Date date)
date
.date
- the date for which to create an ISO-8601-formatted stringpublic static String formatIso8601(Date date, boolean includeMillis)
date
.date
- the date for which to create an ISO-8601-formatted stringincludeMillis
- whether to include millisecond notation within the string.public static Date parseIso8601Date(String s) throws ParseException
Date
instance. The
date string may optionally contain millisecond notation, and those milliseconds will be represented accordingly.s
- the ISO-8601-formatted string to parseDate
instance.ParseException
- if the specified date string is not a validly-formatted ISO-8601 string.Copyright © 2014–2025 jsonwebtoken.io. All rights reserved.