Format

Formats the given data according to the specified picture format string.

Syntax

Format(s1, s2 [, s3 ...])

Parameters

Parameter

Description

s1

The picture format string, which may be a locale-sensitive date or time format.

See Locales.

s2

The source data to format.

For date picture formats, the source data must be either an ISO date-time string or an ISO date string in one of two formats:

  • YYYY[MM[DD]]

  • YYYY[-MM[-DD]]

  • HH[MM[SS[.FFF][z]]]

  • HH[MM[SS[.FFF][+HH[MM]]]]

  • HH[MM[SS[.FFF][-HH[MM]]]]

  • HH[:MM[:SS[.FFF][z]

  • HH[:MM[:SS[.FFF][-HH[:MM]]]]

  • HH[:MM[:SS[.FFF][+HH[:MM]]]]

For time picture formats, the source data must be either an ISO date-time string or an ISO time string in one of the following formats:

  • HH[MM[SS[.FFF][z]]]

  • HH[MM[SS[.FFF][+HH[MM]]]]

  • HH[MM[SS[.FFF][-HH[MM]]]]

  • HH[:MM[:SS[.FFF][z]

  • HH[:MM[:SS[.FFF][-HH[:MM]]]]

  • HH[:MM[:SS[.FFF][+HH[:MM]]]]

For date-time picture formats, the source data must be an ISO date-time string.

For numeric picture formats, the source data must be numeric.

For text picture formats, the source data must be textual.

For compound picture formats, the number of source data arguments must match the number of subelements in the picture.

s3 (Optional)

Additional source data to format.

Examples

The following expressions are examples that use the Format function:

Expression

Returns

Format("MMM D, YYYY", "20020901")

Sep 1, 2002

Format("$9,999,999.99", 1234567.89)

$1,234,567.89 in the U.S. and 1 234 567,89 Euros in France.

// Ethnio survey code removed