Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php date timestamp now

//Get current date time in PHP

// Simply:
$date = date('Y-m-d H:i:s');

// Or:
$date = date('Y/m/d H:i:s');

// This would return the date in the following formats respectively:
$date = '2012-03-06 17:33:07';
// Or
$date = '2012/03/06 17:33:07';

/** 
 * This time is based on the default server time zone.
 * If you want the date in a different time zone,
 * say if you come from Nairobi, Kenya like I do, you can set
 * the time zone to Nairobi as shown below.
 */

date_default_timezone_set('Africa/Nairobi');

// Then call the date functions
$date = date('Y-m-d H:i:s');
// Or
$date = date('Y/m/d H:i:s');

// date_default_timezone_set() function is however
// supported by PHP version 5.1.0 or above.
Comment

PREVIOUS NEXT
Code Example
Php :: get client size in laravel 
Php :: phpstorm serial key 2020.2.3 
Php :: php get size of file 
Php :: laravel mix purge css 
Php :: Laravel loop with counter 
Php :: woocommerce redirect shop page 
Php :: laravel find or create new 
Php :: laravel model to array 
Php :: php sha256 example 
Php :: test a single file laravel 
Php :: php get ip address of visitor 
Php :: string to float php 
Php :: php yesterday date 
Php :: laravel db does not exists 
Php :: using js variable in php 
Php :: laravel env production 
Php :: remove create in nova resource 
Php :: carbon parse sunday 30 days ago 
Php :: laravel debugbar false not working 
Php :: two digits after decimal point in php 
Php :: get domain from subdomain php 
Php :: regex to check date format php 
Php :: php get string between two strings 
Php :: searching and removing element from an array php 
Php :: php copy url 
Php :: php loop through string 
Php :: php artisan make migrate different folder 
Php :: Laravel validation for checkboxes 
Php :: twig print_r 
Php :: symfony exclude class from autowiring 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =