Table for Date Formats
<?php
date_default_timezone_set("Asia/Calcutta"); //India time (GMT+5:30)
echo date('d-m-Y H:i:s');
?>
<?php echo "Current Date : ".date("d/m/y")."<br />"; echo "Current Time : ".date("H:i:sa")."<br />"; echo "Current Day : ".date("l")."<br />"; echo "Current Month : ".date("M")."<br />"; ?>
Output :
Current Date : 19/02/17 Current Time : 15:54:08pm Current Day : Sunday Current Month : Feb
| Format | Description | Example |
|---|---|---|
| a | 'am' या 'pm' lowercase | am |
| A | 'AM' या 'PM' uppercase | AM |
| d | शुरुआत में 0 के साथ 2 digits के month का day 01 से 31 तक | 15 |
| D | 3 letters week का day | Mon |
| F | month का full name | March |
| g | शुरुआत से 0 के बिना hour के लिए 12hour का format 1 से 12 तक | 5 |
| G | शुरुआत से 0 के बिना hour के लिए 24hour का format 0 से 23 तक | 3 |
| h | शुरुआत से 0 के साथ 12hour के format में hour 01 से 12 तक | 05 |
| H | शुरुआत से 0 के साथ 24hour के format में hour 00 से 24 तक | 00 |
| i | शुरुआत से 0 के साथ minutes 00 से 59 तक | 58 |
| I | अगर Daylight Savings Time है तो 1 नहीं तो 0 | 1 |
| j | शुरुआत से 0 के बिना month का day 1 से 31 तक | 27 |
| l | Week का day full name | Friday |
| L | Leap year है तो 1 नहीं तो 0 | 0 |
| m | शुरुआत से 0 के साथ year का month 01 से 12 तक | 02 |
| M | 3 letters year का month | Jun |
| n | शुरुआत से 0 के बिना year का month 1 से 12 तक | 10 |
| r | RFC 822 formatted date | Sun, 19 Feb 2017 19:07:40 +0100 |
| s | seconds 00 से 59 तक | 58 |
| t | check month के days 28 से 31 तक | 31 |
| U | timestamp | 1487527863 |
| y | 2 digits year | 17 |
| Y | 4 digits year | 2017 |
| z | year का day 0 से 365 तक | 106 |
| Z | timezone offset seconds में | 3600 |
No comments:
Post a Comment