Home > Articles > Programming > PHP

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Using the Current Date the U.S./U.K./European Way

<?php
 echo ‘US format: ‘ . date(‘m/d/Y<b\r />‘);
 echo ‘UK format: ‘ . date(‘d/m/Y<b\r />‘);
 echo ‘German format: ‘ . date(‘d.m.Y<b\r />‘);
 echo ‘International format: ‘ . date(‘Y-d-m‘);
?>

To give you a short and convenient reference, the preceding code contains several commonly used date formats. Depending on where you are, the order in which day, month, and year are used might vary:

  • In the United States, it’s (mostly) month, day, and year

  • In the United Kingdom and the rest of Europe, it’s (mostly) day, month, and year

  • The international standard date notation starts with the year and continues with month and day

  • + Share This
  • 🔖 Save To Your Account