Overview
You can change the format of a parsed date field using the Format Dates filter in Mailparser.
This is useful when you need to:
- Standardize date formats (e.g.,
YYYY-MM-DD) - Prepare data for integrations or exports
- Convert human-readable dates into machine-readable formats
How It Works
The Format Dates filter detects a date in your parsed data and converts it into a new format.
- In most cases, Mailparser will automatically recognize the input format
- If needed, you can manually define both the input format and output format
How to Use It
Step 1: Add the Filter
- Open your parsing rule
- Click Add Text Filter
- Navigate to:
Refine Results → Format Dates
Step 2: Review Automatic Formatting
After adding the filter:
- Mailparser will attempt to detect the date format automatically
- A preview will show the converted result
Step 3: Set Custom Input and Output (Optional)
If the date is not recognized correctly:
- Enter the input format (how the date appears in the email)
- Enter the output format (how you want it formatted)
Example:
Input:
Tuesday, 29th August 2015
Input pattern:
l, jS F Y
Output pattern:
Y-m-d
Result:
2015-08-29
Format Syntax
Day Formatting Syntax
| d | Day of the month, 2 digits with leading zeros | 01 to 31 |
| D | A textual representation of a day, three letters | Mon through Sun |
| j | Day of the month without leading zeros | 1 to 31 |
| l(lowercase 'L') | A full textual representation of the day of the week | Sunday throughSaturday |
| S | English ordinal suffix for the day of the month, 2 characters | st, nd, rd or th. Works well with j |
Week Formatting Syntax
| W | ISO-8601 week number of year, weeks starting on Monday | Example: 42 (the 42nd week in the year) |
Month Formatting Syntax
| F | A full textual representation of a month, such as January or March | January through December |
| m | Numeric representation of a month, with leading zeros | 01 through 12 |
| M | A short textual representation of a month, three letters | Jan through Dec |
| n | Numeric representation of a month, without leading zeros | 1 through 12 |
Year Formatting Syntax
| Y | A full numeric representation of a year, 4 digits | Examples: 1999 or 2003 |
| y | A two-digit representation of a year | Examples: 99 or 03 |
Time Formatting Syntax
| a | Lowercase Ante meridiem and Post meridiem | am or pm |
| A | Uppercase Ante meridiem and Post meridiem | AM or PM |
| B | Swatch Internet time | 000 through 999 |
| g | 12-hour format of an hour without leading zeros | 1 through 12 |
| G | 24-hour format of an hour without leading zeros | 0 through 23 |
| h | 12-hour format of an hour with leading zeros | 01 through 12 |
| H | 24-hour format of an hour with leading zeros | 00 through 23 |
| i | Minutes with leading zeros | 00 to 59 |
| s | Seconds, with leading zeros | 00 through 59 |
Other Formatting Options
| timestamp | Returns the Linux timestamp (seconds since 1st Jan 1970) | 1449237286 |
These patterns follow the same syntax as the PHP date function.
Tips
- Use a standard format like
Y-m-dfor better compatibility with other systems - Always check the preview to confirm correct formatting
- If parsing fails, double-check your input pattern
Summary
The Format Dates filter allows you to convert parsed dates into a consistent and usable format.
It works automatically in most cases, but also gives you full control when custom formatting is needed.
Please note that the date filter can be applied to dates that are parsed from the content of the email. The filter is not available for the "received at" and "processed at" dates. Those two dates are generated by Mailparser and always come in a standard format and in the timezone you chose for your account.