
Search In
This blog explains different functions used for date and time manipulation in PHP.
Hello Reader's!, If you want to make the custom php session which will destroy automatic then you can use the code as below:-
session_start(); // ready to go!
$now = time();
if (isset($_SESSION['discard_after']) && $now > $_SESSION['disc
Recently while working for a project I faced an issue while making the site live.
The site was developed with kohana framework and was to be hosted on Godaddy Server (Shared Hosting) and I faced a peculiar issue on the server giving me an error
No
Hello Reader's ,
We can see that posting & Online time changes frequently seconds ago, minutes ago and hours ago etc, In Social media. So Today in my blog I am going explain about timeago and its easy implementation with PHP.
First, you nee
Many a times we need to take out time difference between two time zone using Date class in php. We can use the following code :-
$timeZone = ['Any Timezone'];
$default = date("Y-m-d h:i:s A");// UTC
$dateTimeZone = new Dat
Sometime there is a need to perform different operation on dates for ex:
You may need to :
1) Add two dates/time
2) Subtract two dates/times for ex- to calculate your age by deducting your date of birth from current date.
And many more.
Yo
If you are using PHP and want to get the current date time with respect to your time zone then just use the code below :-
$DateTime = new DateTime(null, new DateTimeZone('Asia/New Delhi'));
$DateTime->setTimezone(new DateTimeZone('Asia/New Delhi
If your server is on a different location and you need a synchronization with it to get in the proper time. Then you need to get the correct time according to that specific location.
To do so the timezone to the specific location.
This can be done b
Hello Reader's if you want to get the current time stamp of Unix in PHP, Then PHP offers your to use this by getTimestamp().
Now let's see this in the example below:-
<?php
$date = new DateTime();
echo $date->getTimestamp();
?>
Output:-
Hello Reader's,
If you want to set session time out for fix time period in PHP use the below code.
$page = $_SERVER['PHP_SELF'];
$sec = "1";
header("Refresh: $sec; url=$page");
session_start();
$now = time();
if(!isset($_SESSION['start'])
