Common Date Formattings

Last modified: 
Thursday, April 16th, 2015

Overview

Outputting common date and time formats.

YYYY-MM-DD

# Bash date
date +%Y-%m-%d
<?php date('Y-m-d'); ?>

YYYY-MM-DD hh:mm:ss

# Bash date
date +'%Y-%m-%d %T'
<?php date('Y-m-d H:i:s'); ?>

YYYY-MM-DD_hh-mm-ss

# Bash date
date +%Y-%m-%d_%H-%M-%S
<?php date('Y-m-d_H-i-s'); ?>

Unix Timestamp

# Bash date
date +%s
<?php time(); ?>


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.