### [How to Use PHP Date and Time Formats in WPForms](https://wpforms.com/developers/how-to-use-php-date-and-time-formats-in-wpforms/)

**Published:** October 21, 2024
**Author:** Umair Majeed

**Excerpt:** Learn how to customize date and time displays using PHP format characters

**Content:**

Would you like to customize how dates and times are displayed in your WPForms? By using PHP date and time parameters, you can format dates and times in various ways to best suit your forms and your users’ needs.

In this guide, we’ll walk you through the most common PHP date and time format characters.

## Understanding Date Format Characters

Here’s a table of the most commonly used characters for formatting dates in WPForms:

Format CharacterDescriptionexample outputdDay of the month, 2 digits with leading zeros01 to 31DA textual representation of a day, three lettersMon through SunjDay of the month without leading zeros1 to 31l (lowercase ‘L’)A full textual representation of the day of the weekSunday through SaturdayNISO 8601 numeric representation of the day of the week1 (for Monday) through 7 (for Sunday)SEnglish ordinal suffix for the day of the month, 2 characters`st`, `nd`, `rd` or `th`. Works well with `j`wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)zThe day of the year (starting from 0)0 through 365WISO 8601 week number of year, weeks starting on MondayExample: 34 (the 34th week in the year)FA full textual representation of a month, such as January or MarchJanuary through DecembermNumeric representation of a month, with leading zeros01 through 12MA short textual representation of a month, three lettersJan through DecnNumeric representation of a month, without leading zeros1 through 12tNumber of days in the given month28 through 31LWhether it’s a leap year1 if it is a leap year, 0 otherwise.oISO 8601 week-numbering year. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead.Examples: 1997 or 2009YA full numeric representation of a year, at least 4 digits, with – for years BCE.Examples: -0044, 0657, 1997, 2006, 20191yA two digit representation of a yearExamples: 97 or 06aLowercase Ante meridiem and Post meridiemam or pmAUppercase Ante meridiem and Post meridiemAM or PMg12-hour format of an hour without leading zeros1 through 12G24-hour format of an hour without leading zeros0 through 23h12-hour format of an hour with leading zeros01 through 12H24-hour format of an hour with leading zeros00 through 23iMinutes with leading zeros00 to 59sSeconds with leading zeros00 through 59uMicrosecondsExample: 654321vMillisecondsExample: 654eTimezone identifierExamples: UTC, GMT, America/New\_YorkI (capital i)Whether or not the date is in daylight saving time1 if Daylight Saving Time, 0 otherwise.ODifference to Greenwich time (GMT) without colon between hours and minutesExample: +0200PDifference to Greenwich time (GMT) with colon between hours and minutesExample: +02:00TTimezone abbreviationExamples: EST, EDTZTimezone offset in seconds-43200 through 50400cISO 8601 date2023-09-09T15:45:30-04:00rRFC 2822 formatted dateWed, 09 Sep 2023 15:45:30 -0400## Using Date Formatting in WPForms

To use these format characters in WPForms, you’ll typically combine them into a string. Here are some common examples:

1. `Y-m-d`: 2024-10-21 (Year-Month-Day)
2. `d/m/Y`: 21/10/2024 (Day/Month/Year)
3. `F j, Y`: October 21, 2024 (Month Day, Year)
4. `D, d M Y`: Mon, 21 Oct 2024 (Abbreviated Day, Day Month Year)

## Practical Examples in WPForms

Here are some ways you might use custom date formatting in WPForms:

1. **In Smart Tags**: Use the `{date}` smart tag with custom formatting: 
    - `{date format="Y-m-d"}` would output the current date as 2024-10-21
    - `{date format="F j, Y"}` would output October 21, 2024
2. **In Date/Time fields**: When setting up a Date/Time field, you can customize the date format: 
    - Using `d/m/Y` for a day/month/year format
    - Use `M j, Y` for a shortened month name format like Oct 21, 2024

**Note**: The default Date/Time field in WPForms offers limited format options. To use custom formats like those mentioned above, you’ll need to create additional formats using a PHP snippet. Please refer to our guide on [creating additional date/time formats](https://wpforms.com/developers/how-to-create-additional-formats-for-the-date-time-field-time-picker/) for more details.

**Categories:** Tutorials, Extending

---

