symfony API

sfDateFormat Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfDateFormat class.

Method Summary

  • string format()
    Formats a date according to the pattern.
  • string getAMPM(, )
    Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.
  • array getDate(, )
    Guesses a date without calling strtotime.
  • int getDayInMonth(, )
    Gets day in the month.
  • string getEra(, )
    Gets the era. i.e. in gregorian, year > 0 is AD, else BC.
  • mixed getFunctionName()
    For a particular token, get the corresponding function to call.
  • string getHour12(, )
    Gets the hours in 12 hour format.
  • int getHourInAMPM(, )
    Gets the hours in AM/PM format, e.g [1-12]
  • int getHourInDay(, )
    Gets the hours [1-24].
  • string getHours(, )
    Gets the hours in 24 hour format, i.e. [0-23].
  • string getInputPattern()
    Returns an easy to parse input pattern
  • string getMday(, )
    Gets the day of the month.
  • string getMinutes(, )
    Gets the minutes.
  • string getMon(, )
    Gets the month.
  • string getPattern()
    Gets the pattern from DateTimeFormatInfo or some predefined patterns.
  • string getSeconds(, )
    Gets the seconds.
  • string getTimeZone(, )
    Gets the timezone from the server machine.
  • array getTokens()
    Tokenizes the pattern. The tokens are delimited by group of
  • getUnixDate()
  • string getWday(, )
    Gets the day of the week.
  • int getWeekInMonth()
    Gets week in the month.
  • int getWeekInYear(, )
    Gets the week in the year.
  • int getYday(, )
    Gets the day in the year, e.g. [1-366]
  • string getYear(, )
    Gets the year.
  • sfDateFormat __construct()
    Initializes a new sfDateFormat.

Method Details

  • (string) format () Browse code

    Formats a date according to the pattern.

    returns formatted date time.

  • (string) getAMPM (, ) Browse code

    Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.

    returns AM or PM designator

  • (array) getDate (, ) Browse code

    Guesses a date without calling strtotime.

    returns same array as the getdate function

  • (int) getDayInMonth (, ) Browse code

    Gets day in the month.

    returns day in month

  • (string) getEra (, ) Browse code

    Gets the era. i.e. in gregorian, year > 0 is AD, else BC.

    returns era

  • (mixed) getFunctionName () Browse code

    For a particular token, get the corresponding function to call.

    returns the function if good token, null otherwise.

  • (string) getHour12 (, ) Browse code

    Gets the hours in 12 hour format.

    "h" for non-padding, "hh" will always return 2 characters.

    returns hours in 12 hour format.

  • (int) getHourInAMPM (, ) Browse code

    Gets the hours in AM/PM format, e.g [1-12]

    returns hours in AM/PM format.

  • (int) getHourInDay (, ) Browse code

    Gets the hours [1-24].

    returns hours [1-24]

  • (string) getHours (, ) Browse code

    Gets the hours in 24 hour format, i.e. [0-23].

    "H" for non-padding, "HH" will always return 2 characters.

    returns hours in 24 hour format.

  • (string) getInputPattern () Browse code

    Returns an easy to parse input pattern

    yy is replaced by yyyy and h by H

    returns input pattern

  • (string) getMday (, ) Browse code

    Gets the day of the month.

    "d" for non-padding, "dd" will always return 2 characters.

    returns day of the month

  • (string) getMinutes (, ) Browse code

    Gets the minutes.

    "m" for non-padding, "mm" will always return 2 characters.

    returns minutes.

  • (string) getMon (, ) Browse code

    Gets the month.

    "M" will return integer 1 through 12
    "MM" will return the narrow month name, e.g. "J"
    "MMM" will return the abrreviated month name, e.g. "Jan"
    "MMMM" will return the month name, e.g. "January"

    returns month name

  • (string) getPattern () Browse code

    Gets the pattern from DateTimeFormatInfo or some predefined patterns.

    If the $pattern parameter is an array of 2 element, it will assume
    that the first element is the date, and second the time
    and try to find an appropriate pattern and apply
    DateTimeFormatInfo::formatDateTime
    See the tutorial documentation for futher details on the patterns.

    returns a pattern.

  • (string) getSeconds (, ) Browse code

    Gets the seconds.

    "s" for non-padding, "ss" will always return 2 characters.

    returns seconds

  • (string) getTimeZone (, ) Browse code

    Gets the timezone from the server machine.

    returns time zone

  • (array) getTokens () Browse code

    Tokenizes the pattern. The tokens are delimited by group of

    similar characters, e.g. 'aabb' will form 2 tokens of 'aa' and 'bb'.
    Any substrings, starting and ending with a single quote (')
    will be treated as a single token.

    returns string tokens in an array.

  • getUnixDate () Browse code

  • (string) getWday (, ) Browse code

    Gets the day of the week.

    "E" will return integer 0 (for Sunday) through 6 (for Saturday).
    "EE" will return the narrow day of the week, e.g. "M"
    "EEE" will return the abrreviated day of the week, e.g. "Mon"
    "EEEE" will return the day of the week, e.g. "Monday"

    returns day of the week.

  • (int) getWeekInMonth () Browse code

    Gets week in the month.

    returns week in month

  • (int) getWeekInYear (, ) Browse code

    Gets the week in the year.

    returns week in year

  • (int) getYday (, ) Browse code

    Gets the day in the year, e.g. [1-366]

    returns hours in AM/PM format.

  • (string) getYear (, ) Browse code

    Gets the year.

    "yy" will return the last two digits of year.
    "yyyy" will return the full integer year.

    returns year

  • (sfDateFormat) __construct () Browse code

    Initializes a new sfDateFormat.

    returns instance