Php Date Time Now - Php

How to display current date and time using php code?

Snippet Code


  
Rate this page :
  [ 0 votes]

This php code can be used to get date and time now. Here, get_Datetime_Now() function is used to display current date and time.

<?php function get_Datetime_Now() { $tz_object = new DateTimeZone('Asia/Kolkata'); $datetime = new DateTime(); $datetime->setTimezone($tz_object); return $datetime->format('Y-m-d h:i:s'); } echo get_Datetime_Now(); ?>

Tags


Ask Questions

Ask Question