If you are using CodeIgniter Framework and you want to add or show current Date and Time in to your webpage then follow the below steps and you will able do that.
Step 1 : Go to your CodeIgniter Directory and click on Application and then Config folder and then click on config.php file.
application --> config --> config.php
Step 2 : In config.php file add the following code:
date_default_timezone_set('Asia/Kolkata');
Note : For your local time and date put your country name and location in Asia/Kolkata.
Step 3 : After that in your view folder choose a file where you want to show your local time and date. Choose the file and put the following code:
echo date("l j \, F Y h:i:s A");
IDE Used To Test This Code : Eclipse for PHP.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Step 1 : Go to your CodeIgniter Directory and click on Application and then Config folder and then click on config.php file.
application --> config --> config.php
Step 2 : In config.php file add the following code:
date_default_timezone_set('Asia/Kolkata');
Note : For your local time and date put your country name and location in Asia/Kolkata.
Step 3 : After that in your view folder choose a file where you want to show your local time and date. Choose the file and put the following code:
echo date("l j \, F Y h:i:s A");
Step 4 : That's all. Now you will able to see your local time and date.
IDE Used To Test This Code : Eclipse for PHP.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Post a Comment