How to Get Date and Time In PHP?
Hi Guys,
In this example,I will learn you how to get current time and date in php. you can easy and simply get yo time and date in php.
Example 1:
<?php
$today = date('Y-m-d H:i:s');
echo($today);
?>
Output:
2020-12-16 10:37:49
Example 2:
<?php
$today = date("F j, Y, g:i a");
echo($today);
?>
Output:
December 16, 2020, 10:37 am
Example 3:
<?php
$today = date("j, n, Y");
echo($today);
?>
Output:
16, 12, 2020
Example 4:
<?php
$today = date("D M j G:i:s T Y");
echo($today);
?>
Output:
Wed Dec 16 10:35:55 IST 2020
Example 5:
<?php
$today = date("l M j G:i:s T Y");
echo($today);
?>
Output:
Wednesday Dec 16 11:05:18 IST 2020
It will help you...
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example