Skip to content
Advertisement

How to show time with php code with the right timezone

I need to show current time on my site in my city Iran/Tehran

I’m using this code:

 <?php echo date('H:i'); ?> 

but it doesn’t show the right time.

my country timezone : iran/tehran

my city time now is : 17:45

but on the site it shows me : 23:15

I don’t know what time zone my server is in & I can’t change that, please help me.

Advertisement

Answer

Try to change timezone in you code like that:

date_default_timezone_set('you/timezone');
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement