JavaScript Date Format
✓ Published0🌍 Public
Aabonello
Last edited Jun 8, 2012
Created on Dec 30, 2021
This example demonstrates the JavaScript `dateFormat` library, which formats dates and times using customizable mask patterns. It shows how to apply masks like `shortDate`, `longDate`, and `isoDateTime` to produce strings such as `m/d/yy` or `yyyy-mm-dd'T'HH:MM:ss`. The code defines a closure-based formatter with regex token parsing and supports UTC conversion, internationalized day and month names, and common presets. It also extends `Date.prototype` with a `.format()` method for direct usage. The data source is the current date or any user-supplied date, processed through `Date.parse`.
AI-generated description