Tentukan Timezone

Written by Sumardi Shukor


1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...


Anda perlu menentukan timezone bagi membolehkan php mengeluarkan output tarikh & masa yang tepat. Bagi menentukkan timezone, anda boleh menggunakan fungsi date_default_timezone_set(). Sebagai contoh, bagi menentukan timezone Malaysia :

1
2
3
4
5
6
7
<?php
 
date_default_timezone_set("Asia/Kuala_Lumpur");
 
// paparkan tarikh & masa yang tepat mengikut timezone
echo date("d-m-Y h:i a", time()); 
?>

Senarai timezone boleh dirujukan di sini.




Tags:

Posted on: November 14, 2008

Filed under: Tips

Related Posts:

  • No Related Post

Comments (3)

X-cs225

December 18th, 2008 at 11:31 pm    

avatar

Bro, ada pembetulan skit.

date_default_timezone_set(’Asia/Kuala_Lumpur’);

admin

December 19th, 2008 at 12:07 am    

avatar

@X-cs225

opss. typing error. thanks.

waki

September 30th, 2009 at 3:42 pm    

avatar

eloo…
aku try yg

date_default_timezone_set(”Asia/Kuala_Lumpur”);

br lh….

aku try yg ni xlh…

date_default_timezone_set(’Asia/Kuala_Lumpur’);

sori bro…

Leave a reply

Name *

Mail *

Website