Top Description Inners Fields Constructors Methods
org.hsqldb.types

public Class DateFormat

extends Object
Class Inheritance
Imports
org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.ArrayUtil, java.text.ParsePosition, java.time.LocalDate, .LocalDateTime, .LocalTime, .OffsetDateTime, .OffsetTime, .ZoneOffset, java.time.format.DateTimeFormatter, .DateTimeFormatterBuilder, java.time.temporal.ChronoField, .Temporal, .TemporalAccessor, java.util.Arrays, .Locale

Parses and formats date time objects with the given pattern.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
2.7.3
Version
2.7.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
DateFormat.Tokenizer

This class can match 64 tokens at maximum.

Field Summary

Modifier and TypeField and Description
private static final char[][]
private static final char
e

Indicates end-of-input

private static final char[]
private static final String[]
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static TimestampData
toDate(DateTimeType dataType, String string, DateTimeFormatter formatter)

public static TimestampData
toDate(DateTimeType dataType, String string, String pattern)

public static String
toFormattedDate(DateTimeType dataType, Object dateTime, DateTimeFormatter formatter)

public static String
toFormattedDate(DateTimeType dataType, Object dateTime, String pattern)

public static DateTimeFormatter
toFormatter(String pattern, boolean parse)

public static String
toJavaDatePattern(String
date format
format
,
boolean
false for formatting
parse
)

Converts the given format into a pattern accepted by java.time.DateTimeFormatter

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dateTokensback to summary
private static final char[][] dateTokens
eback to summary
private static final char e

Indicates end-of-input

fixedFractionback to summary
private static final char[] fixedFraction
javaDateTokensback to summary
private static final String[] javaDateTokens
javaPrefixback to summary
private static final String javaPrefix
variableFractionback to summary
private static final String variableFraction

Constructor Detail

DateFormatback to summary
public DateFormat()

Method Detail

toDateback to summary
public static TimestampData toDate(DateTimeType dataType, String string, DateTimeFormatter formatter)
toDateback to summary
public static TimestampData toDate(DateTimeType dataType, String string, String pattern)
toFormattedDateback to summary
public static String toFormattedDate(DateTimeType dataType, Object dateTime, DateTimeFormatter formatter)
toFormattedDateback to summary
public static String toFormattedDate(DateTimeType dataType, Object dateTime, String pattern)
toFormatterback to summary
public static DateTimeFormatter toFormatter(String pattern, boolean parse)
toJavaDatePatternback to summary
public static String toJavaDatePattern(String format, boolean parse)

Converts the given format into a pattern accepted by java.time.DateTimeFormatter

Parameters
format:String

date format

parse:boolean

false for formatting

org.hsqldb.types back to summary

pack-priv Class DateFormat.Tokenizer

extends Object
Class Inheritance

This class can match 64 tokens at maximum.

Field Summary

Modifier and TypeField and Description
private boolean
private static char[]
private boolean
private int
private final char[]
private boolean
private int
private int
private final char
private long
private final char[][]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
getLastMatch()

Returns an index of the last matched token.

public boolean
isConsumed()

Indicates whether the last character has been consumed by the matcher.

public boolean
isInQuotes()

Indicates if tokenizing a quoted string

public boolean
isLiteral(char ch)

Returns true if ch is in the list of literals

public boolean
isQuoteChar(char ch)

returns true if character is the quote char and sets state

private boolean
isZeroBit(int
numbered from high bit
bit
)

Checks whether the specified bit is not set.

public int
length()

Returns the length of a token to match.

public boolean
next(char
character
ch
,
int
in the string
position
)

Matches the specified character against tokens.

public void
reset()

Resets for next reuse.

private void
setBit(int
numbered from high bit
bit
)

Sets the specified bit.

public boolean
wasMatched()

Indicates whether the last character has been matched by the matcher.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

consumedback to summary
private boolean consumed
defaultLiteralsback to summary
private static char[] defaultLiterals
isInQuotesback to summary
private boolean isInQuotes
lastMatchedback to summary
private int lastMatched
literalCharsback to summary
private final char[] literalChars
matchedback to summary
private boolean matched
matchOffsetback to summary
private int matchOffset
offsetback to summary
private int offset
quoteCharback to summary
private final char quoteChar
stateback to summary
private long state
tokensback to summary
private final char[][] tokens

Constructor Detail

Tokenizerback to summary
public Tokenizer()

Method Detail

getLastMatchback to summary
public int getLastMatch()

Returns an index of the last matched token.

isConsumedback to summary
public boolean isConsumed()

Indicates whether the last character has been consumed by the matcher.

isInQuotesback to summary
public boolean isInQuotes()

Indicates if tokenizing a quoted string

isLiteralback to summary
public boolean isLiteral(char ch)

Returns true if ch is in the list of literals

isQuoteCharback to summary
public boolean isQuoteChar(char ch)

returns true if character is the quote char and sets state

isZeroBitback to summary
private boolean isZeroBit(int bit)

Checks whether the specified bit is not set.

Parameters
bit:int

numbered from high bit

lengthback to summary
public int length()

Returns the length of a token to match.

nextback to summary
public boolean next(char ch, int position)

Matches the specified character against tokens.

Parameters
ch:char

character

position:int

in the string

resetback to summary
public void reset()

Resets for next reuse.

setBitback to summary
private void setBit(int bit)

Sets the specified bit.

Parameters
bit:int

numbered from high bit

wasMatchedback to summary
public boolean wasMatched()

Indicates whether the last character has been matched by the matcher.