Apakah ada daftar zona waktu untuk Amerika Serikat yang bisa saya gunakan dengan php? Saya menggunakan nama zona waktu dari php seperti America/Anchorage, php mencantumkan zona waktu di sini: http://us.php.net/manual/en/timezones.others.php Saya ingin menampilkannya secara drop-down agar pengguna dapat memilih, tetapi saya hanya membutuhkan yang untuk AS, saya tidak ingin menunjukkan banyak yang berada di luar AS. Berikut adalah daftar yang saya temukan:
Seperti kata deceze, Anda dapat menggunakan flag PER_COUNTRY.
Keluaran:
Ini akan secara otomatis memberi Anda daftar zona waktu Amerika:
Perhatikan bahwa ini akan mencakup zona waktu Amerika Selatan, Kanada dll. Anda bisa bermain-main dengan Cara kasar untuk mendapatkan SEMUA zona waktu per negara menggunakan GEOIP PHP. Kode ini tidak dimaksudkan untuk terlihat bagus. Anda harus memanggil ini hanya sekali dan menyimpan hasilnya di suatu tempat. Bagi anda yang mempunyai masalah atau warning funtion.date, berikut cara setting Time Zone untuk PHP 5.3.0, Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Jakarta’ for ‘WIT/7.0/no DST’ instead in /home/xxxxxx/public_html/config.php on line 99 dari error diatas dapat diartikal bahwa ada kesalahan pada timezone setting jadi kita harus melakukan setting sesuai yang di infokan. We selected ‘Asia/Jakarta’ for ‘WIT/7.0/no DST’ instead in /home/xxxxxx/public_html/config.php on line 99 ini menandakan bahwa skrip website anda memilih setting waktu ‘Asia/Jakarta’ sehingga kita harus menyesuaikan dengan setting waktu yang ada di skrip website kita. Caranya adalah sebagai berikut: Buka file php.ini, jika file blm ada anda bisa create new file php.ini date.timezone = {tulis timezone disini} contohnya bila di indonesia menggunakan time zone berikut: date.timezone = Asia/Jakarta kemudian Save file php.ini dan selesai
If you notice the incorrect time in your PHP scripts, the likely culprit is that the hosting server is in a different timezone. For example, when you’re an InMotion web hosting customer, you can select from data centers in Washington, D.C., or California, which means the server’s timezone will be either Eastern Standard Time (EST) or Pacific Standard Time (PST). If you want to change that, it’s a quick fix. Simply insert a line of code into your php.ini file and the location you set in the code will determine the time to display in your PHP scripts. Keep reading to learn how.
Congratulations! You are now able to set the timezone in PHP. If you wish to see more guides with tips and information for your website issues, please see our InMotion Hosting Support Center! Sell hosting using your own brand with a powerful Reseller Hosting plan, now with more resources and faster storage using SSDs at no extra cost. Arnel Custodio Content Writer I As a writer for InMotion Hosting, Arnel has always aimed to share helpful information and provide knowledge that will help solve problems and aid in achieving goals. He's also been active with WordPress local community groups and events since 2004. More Articles by Arnel |