stellarwp/dates

Date utilities and classes.

1.1.2 2023-08-19 13:27 UTC

This package is auto-updated.

Last update: 2024-04-19 14:54:17 UTC


README

Tests Static Analysis

A collection of date utilities authored by the development team at StellarWP and provided free for the WordPress community.

This work is forked from the battle-tested date handling done at The Events Calendar!

Installation

It's recommended that you install Dates as a project dependency via Composer:

composer require stellarwp/dates

We actually recommend that this library gets included in your project using Strauss.

Luckily, adding Strauss to your composer.json is only slightly more complicated than adding a typical dependency, so checkout our strauss docs.

Documentation

Constants

Constant Format Description
DATEONLYFORMAT F j, Y The date format used for date-only strings.
TIMEFORMAT g:i A The time format used for time-only strings.
HOURFORMAT g The hour format used for hour-only strings.
MINUTEFORMAT i The minute format used for minute-only strings.
MERIDIANFORMAT A The meridian format used for meridian-only strings.
DBDATEFORMAT Y-m-d The date format used for date-only strings in the database.
DBDATETIMEFORMAT Y-m-d H:i:s The date format used for date-time strings in the database.
DBTZDATETIMEFORMAT Y-m-d H:i:s O The date format used for date-time strings in the database with timezone.
DBTIMEFORMAT H:i:s The date format used for time-only strings in the database.
DBYEARMONTHTIMEFORMAT Y-m The date format used for year-month strings in the database.