downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

date_default_timezone_set> <date_date_set
Last updated: Fri, 27 Nov 2009

view this page in

date_default_timezone_get

(PHP 5 >= 5.1.0)

date_default_timezone_get Betik içerisindeki tüm tarih/zaman işlevleri tarafından kullanılan öntanımlı zaman dilimini getirir

Açıklama

string date_default_timezone_get ( void )

Bu işlev tercih sırasına göre öntanımlı zaman dilimini şöyle döndürür:

  • date_default_timezone_set() işlevi kullanılarak atanan zaman dilimiyle (eğer varsa).

  • TZ ortam değişkenindeki değerle (boş değilse).

  • date.timezone ini yönergesindeki değerle (ayarlanmışsa).

  • Ev sahibi işletim sistemini sorgulayarak (işletim sistemi destekliyor ve izin veriyorsa).

Eğer yukarıdakilerin hiçbirisi başarılı değilse, date_default_timezone_get işlevi öntanımlı UTC zaman dilimini döndürecektir.

Dönen Değerler

string türünde geri döner.

Örnekler

Örnek 1 - Öntanımlı zaman diliminin getirilmesi

<?php
date_default_timezone_set
('Europe/Istanbul');

if (
date_default_timezone_get()) {
    echo 
'date_default_timezone_set: 'date_default_timezone_get() .'<br />';
}

if (
ini_get('date.timezone')) {
    echo 
'date.timezone: ' ini_get('date.timezone');
}

?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:

date_default_timezone_set: Europe/Istanbul
date.timezone: Europe/Istanbul

Örnek 2 - Zaman diliminin kısaltmasının getirilmesi

<?php
date_default_timezone_set
('Europa/Istanbul');
echo 
date_default_timezone_get() . ' => ' date('e') . ' => ' date('T');
?>

Yukarıdaki örneğin çıktısı:

Europe/Istanbul => Europe/Istanbul => EET

Ayrıca Bakınız



add a note add a note User Contributed Notes
date_default_timezone_get
harmor
28-Feb-2008 04:19
If you want to get the abbrivation (3 or 4 letter), instead of the long timezone string you can use date('T') function like this:

Input:
date_default_timezone_set('America/Los_Angeles');
echo date_default_timezone_get();
echo ' => '.date('e');
echo ' => '.date('T');

Output:
America/Los_Angeles => America/Los_Angeles => PST
dohpaz at gmail dot com
20-Apr-2007 09:58
date_default_timezone_get() will still emit a warning in E_STRICT if the timezone is not set; either by date_default_timezone_set() or the ini option of date.timezone.

This is probably not a big deal, but I thought I would contribute what I found.

date_default_timezone_set> <date_date_set
Last updated: Fri, 27 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites