Name

<fmt:parseDate>

Synopsis

The <fmt:parseDate> action parses a date and time value formatted according to locale-specific rules. A custom pattern can be specified, or locale-dependent default patterns for one or both of the date portion and the time portion can be selected.

The locale used is the one explicitly specified or is taken from the locale configuration setting or the locale from the localization context setting. If none of these are set, the locale is determined as the best match for the user preferences (Accept-Language request header).

Syntax 1: Without a body

<fmt:parseDate value="dateAndTime" 
  [pattern="pattern" |
    [type="time|date|both"]
    [dateStyle="default|short|medium|long|full"]
    [timeStyle="default|short|medium|long|full"]]
  [timeZone="timeZone"]
  [parseLocale="locale"]
  [var="var" [scope="page|request|session|application"]] />

Syntax 2: With a body

<fmt:parseDate 
  [pattern="pattern" |
    [type="time|date|both"]
    [dateStyle="default|short|medium|long|full"]
    [timeStyle="default|short|medium|long|full"]]
  [timeZone="timeZone"]
  [parseLocale="locale"]
  [var="var" [scope="page|request|session|application"]]>
  dateAndTime
</fmt:parseDate>

Attributes

Attributename

Java type

Dynamic valueaccepted

Description

value
String

Yes

The date and time to parse

pattern
String

Yes

A custom pattern in the form accepted by java.text.SimpleDateFormat; see fmt:formatDate.

type
String

Yes

Which portions the value contains.

dateStyle
String

Yes

One of the predefined locale-dependent ...

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.