• 🏠 Home
  • 🧰 Online Generators
  • 📰 Blog
  • 🔎 Search
  • 📧 Contact
  • 📘 Guestbook
  • 🗞️ News
  • 💰 Support
  • ℹ️ Info: The website has been modernized to improve readability and smartphone compatibility. Feel free to report any bugs using the contact form

    date statement


    Overview

    The date statement can be used to display the date and time.

    Usage

    Function date () is used in different ways. It always returns a string corresponding to what we asked him (hour, day, month, etc. ...).
    Important: the returned parameters are those returned from the server.
    To work, the function requires one or more of the following parameters:

    CharMeaningPossible values
    Day
    jDay of the month on two digits without leading zeros1 to 31
    dDay of the month on two digits with leading zeros01 to 31
    l(L tiny) Day of the week (english)Sunday to Saturday
    wDay of week in digital format0 (sunday) to 6 (saturday)
    zDay of the week0 to 366
    Week
    WWeek number, for current month (weeks are starting on mondays)Example : 42 (week 42 of the year)
    Months
    FMonth, textualJanuary to December
    mMonth, in numerical format, with leading zeros01 to 12
    nMonth, in numerical format, without leading zeros1 to 12
    tNumber of days, in the month28 to 31
    Year
    LIs it a leap year?1 if leap, else: 0.
    YYear, with 4 digitsExamples : 1999 and 2003
    yYear, with 2 digitsExamples : 99 and 03
    Time
    aAnte meridian and post meridian (lower)am or pm
    AAnte meridian and post meridian (upper)AM or PM
    gHour (12h format) without leading zeros1 to 12
    GHour (24h format) without leading zeos0 to 23
    hHour (12h format) with leading zeros01 to 12
    HHour (24h format) with leading zeros00 to 23
    sSeconds, with leading zeros00 to 59
    iMinutes, with leading zeros00 to 59

    Code Examples:

    <?php
      echo date('Y'); //Will display current year (4 digits)
    ?>
     
    <?php
      echo date('m').' '.date('Y'); //display the month on two digits and the current year in 4 digits
    ?>
     
    <?php
      echo date('m Y'); //display the month on two digits and the current year in 4 digits
    ?>
     
    <?php
      echo date('m/Y');
    ?>
    Go back


    (c) 2005-2025 Jérôme DESMOULINS
    Data privacy