␡
- Using Text Within date()
- Automatically Localizing Dates
- Manually Localizing Dates
- Using the Current Date the U.S./U.K./European Way
- Formatting a Specific Date
- Validating a Date
- Calculating a Relative Date
- Creating a Sortable Time Stamp
- Converting a String into a Date
- Determining Sunrise and Sunset
- Using Date and Time for Benchmarks
- Using Form Fields for Date Selection
- Create Self-updating Form Fields for Date Selection
- Calculating the Difference Between Two Dates
- Using GMT Date/Time Information
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