PHP Saat ve Dakika Başlarken

4 Cevap php

Ben Hour, şimdiki zaman almak gerekir: Dk biçimi, herhangi biri bu bana yardımcı olabilir.

4 Cevap

print date('H:i');
$var = date('H:i');

Şimdiki zaman için, bunu yapmak gerekir. Yerine 24 saat 12 saatlik bir küçük harf h kullanın.

Bu deneyin:

$hourMin = date('H:i');

Bu her zaman iki basamaklı bir saat ile 24 saatlik bir zaman olacaktır. Tüm seçenekler için, PHP docs for date() bkz.

print date('H:i');

Sen php.ini doğru zaman dilimini ayarlamak zorunda.

Bu satırlara bakın:

[Date]

; Defines the default timezone used by the date functions

;date.timezone =

Bu gibi bir şey olacak:

date.timezone ="Europe/Lisbon"

Lütfen web sunucusu yeniden unutmayın.

In addressing your comment that you need your current time, and not the system time, you will have to make an adjustment yourself, there are 3600 seconds in an hour (the unit timestamps use), so use that. for example, if your system time was one hour behind:

$ Zaman = date ('H: i', time () + 3600);