Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get exact IST time in php?

Tags:

timezone

php

time

In php, I used date function (eg: date('Y-m-d h-m-s')) it won’t displaying current time Please help me…

like image 818
Kushal Avatar asked Nov 28 '22 15:11

Kushal


1 Answers

You want indian time.Here is my solution. You can use either Asia/Calcutta or Asia/Kolkata. both will return same time.

date_default_timezone_set('Asia/Calcutta');
echo date('Y-m-d h-i-s'); 

It worked for me.Try...

like image 172
Abhishek Avatar answered Dec 05 '22 20:12

Abhishek