public class Dates extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Dates.DateAdapter |
static class |
Dates.DateTimeAdapter |
Modifier and Type | Field and Description |
---|---|
static String |
DATE_FORMAT
The format used for dates in the REST plugin.
|
static org.joda.time.format.DateTimeFormatter |
ISO_DATE_TIME_PARSER
Parser for rest times - this one - accepts Z as timezone.
|
static org.joda.time.format.DateTimeFormatter |
ISO_DATE_TIME_PRINTER
Printer for rest time entries - this one should print +0000 for UTC timezone.
|
static String |
TIME_FORMAT
The format used for times in the REST plugin.
|
Modifier and Type | Method and Description |
---|---|
static String |
asDateString(Date date)
Converts the given Date object to a String.
|
static String |
asDateString(Timestamp timestamp)
Converts the given Timestamp object to a String.
|
static String |
asISODateTimeString(org.joda.time.DateTime dateTime)
Converts the given DateTime object to ISO String.
|
static String |
asTimeString(Date date)
Converts the given Date object to a String.
|
static String |
asTimeString(Timestamp timestamp)
Converts the given Timestamp object to a String.
|
static Date |
fromDateString(String date)
Converts the given date String into a Date object.
|
static org.joda.time.DateTime |
fromISODateTimeString(String date) |
static Date |
fromTimeString(String time)
Converts the given date and time String to a Date object.
|
public static final String DATE_FORMAT
public static final String TIME_FORMAT
public static final org.joda.time.format.DateTimeFormatter ISO_DATE_TIME_PARSER
public static final org.joda.time.format.DateTimeFormatter ISO_DATE_TIME_PRINTER
public static String asTimeString(@Nullable Date date)
"yyyy-MM-dd\'T\'HH:mm:ss.SSSZ"
.date
- a Datepublic static String asTimeString(@Nullable Timestamp timestamp)
"yyyy-MM-dd\'T\'HH:mm:ss.SSSZ"
.timestamp
- a Datepublic static Date fromTimeString(@Nullable String time) throws IllegalArgumentException
"yyyy-MM-dd\'T\'HH:mm:ss.SSSZ"
.time
- a String representation of a date and timeRuntimeException
- if there is an error parsing the dateIllegalArgumentException
- if the input string is not in the expected formatpublic static String asDateString(@Nullable Date date)
"yyyy-MM-dd"
.date
- a Datepublic static String asDateString(@Nullable Timestamp timestamp)
"yyyy-MM-dd"
.timestamp
- a Datepublic static Date fromDateString(@Nullable String date) throws IllegalArgumentException
"yyyy-MM-dd"
.date
- a String containing a dateIllegalArgumentException
- if the input string is not in the expected formatpublic static String asISODateTimeString(@Nullable org.joda.time.DateTime dateTime)
Copyright © 2002-2023 Atlassian. All Rights Reserved.