i wnt time php code.plz anyone have dis.
Time Php
Started on the old forum in December 2007 · view the original in the archive · old links redirect here
// set the default timezone to use. Available since PHP 5.1 date_default_timezone_set('UTC');
// Prints something like: Monday echo date("l");
// Prints something like: Monday 15th of August 2005 03:12:46 PM echo date('l dS \of F Y h:i:s A');
// Prints: July 1, 2000 is on a Saturday echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
/* use the constants in the format parameter */ // prints something like: Mon, 15 Aug 2005 15:12:46 UTC echo date(DATE_RFC822);
// prints something like: 2000-07-01T00:00:00+00:00 echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
// Assuming today is: March 10th, 2001, 5:16:18 pm
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $today = date("m.d.y"); // 03.10.01 $today = date("j, n, Y"); // 10, 3, 2001 $today = date("Ymd"); // 20010310 $today = date('h-i-s, j-m-y, it is w Day z '); // 05-16-17, 10-03-01, 1631 1618 6 Fripm01 $today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // It is the 10th day. $today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001 $today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month $today = date("H:i:s"); // 17:16:17
hey thanks black.could i get date and time for funmobile.
$t = date("H:i"); echo $t; // 15:30 same way for time or time+date.
thnks black. External image (may be gone)
thnks black. External image (may be gone)
what about time for different countrys e.g some1 from england get uk time and some1 from france get france time but on same site
<?php // Get timestamp in server timezone $time = time(); echo "Server time: " . date("d/m/Y H:i", $time) . ""; // Get GMT timestamp $gm_time = $time - date('Z', $time); echo "GMT time: " . date("d/m/Y H:i", $gm_time) . ""; // Difference: $diff = ($time - $gm_time)/3600; if ($diff < 0) { $timezone = 'GMT' . $diff; } else { $timezone = 'GMT+' . $diff; } echo 'Server timezone: ' . date('T', $time) . ''; echo 'Server timezone offset: ' . $timezone; ?>
<?php $original_tz = getenv('TZ'); $format = "d/m/Y H:i"; // Server time: $server_time = time(); echo 'Server time: ' . date($format, time()) . ''; // GMT time: $gm_time = $server_time - date('Z', $server_time); echo "GMT time: " . date($format, $gm_time) . ""; // Africa/Cairo putenv('TZ=Africa/Cairo'); $a_time = $gm_time + date('Z', time()); putenv('TZ=' . $original_tz); echo 'Africa/Cairo time: ' . date($format, $a_time) . ""; // America/Los Angeles putenv('TZ=America/Los_Angeles'); $a_time = $gm_time + date('Z', time()); putenv('TZ=' . $original_tz); echo 'America/Los Angeles: ' . date($format, $a_time) . ""; // Europe/London putenv('TZ=Europe/London'); $a_time = $gm_time + date('Z', time()); putenv('TZ=' . $original_tz); echo 'Europe/London: ' . date($format, $a_time) . ""; putenv('TZ=' . $original_tz); ?>
where: Afrikaans = af Albanian = sq Arabic (Algeria) = ar-dz Arabic (Bahrain) = ar-bh Arabic (Egypt) = ar-eg Arabic (Iraq) = ar-iq Arabic (Jordan) = ar-jo Arabic (Kuwait) = ar-kw Arabic (Lebanon) = ar-lb Arabic (libya) = ar-ly Arabic (Morocco) = ar-ma Arabic (Oman) = ar-om Arabic (Qatar) = ar-qa Arabic (Saudi Arabia) = ar-sa Arabic (Syria) = ar-sy Arabic (Tunisia) = ar-tn Arabic (U.A.E.) = ar-ae Arabic (Yemen) = ar-ye Arabic = ar Armenian = hy Assamese = as Azeri (Cyrillic) = az Azeri (Latin) = az Basque = eu Belarusian = be Bengali = bn Bulgarian = bg Catalan = ca Chinese (China) = zh-cn Chinese (Hong Kong SAR) = zh-hk Chinese (Macau SAR) = zh-mo Chinese (Singapore) = zh-sg Chinese (Taiwan) = zh-tw Chinese = zh Croatian = hr Chech = cs Danish = da Divehi = div Dutch (Belgium) = nl-be Dutch (Netherlands) = nl English (Australia) = en-au English (Belize) = en-bz
English (Canada) = en-ca English (Caribbean) = en English (Ireland) = en-ie English (Jamaica) = en-jm English (New Zealand) = en-nz English (Philippines) = en-ph English (South Africa) = en-za English (Trinidad) = en-tt English (United Kingdom) = en-gb English (United States) = en-us English (Zimbabwe) = en-zw English = en Estonian = et Faeroese = fo Farsi = fa Finnish = fi French (Belgium) = fr-be French (Canada) = fr-ca French (France) = fr French (Luxembourg) = fr-lu French (Monaco) = fr-mc French (Switzerland) = fr-ch FYRO Macedonian = mk Gaelic = gd Georgian = ka German (Austria) = de-at German (Germany) = de German (Liechtenstein) = de-li German (lexumbourg) = de-lu German (Switzerland) = de-ch Greek = el Gujarati = gu Hebrew = he Hindi = hi Hungarian = hu Icelandic = is Indonesian = id Italian (Italy) = it Italian (Switzerland) = it-ch Japanese = ja Kannada = kn Kazakh = kk Konkani = kok Korean = ko Kyrgyz = kz Latvian = lv Lithuanian = lt Malay (Brunei) = ms Malay (Malaysia) = ms Malayalam = ml Maltese = mt Marathi = mr Mongolian (Cyrillic) = mn Nepali (India) = ne Norwegian (Bokmal) = nb-no Norwegian (Bokmal) = no Norwegian (Nynorsk) = nn-no Oriya = or Polish = pl Portuguese (Brazil) = pt-br Portuguese (Portugal) = pt Punjabi = pa Rhaeto-Romanic = rm Romanian (Moldova) = ro-md Romanian = ro Russian (Moldova) = ru-md Russian = ru Sanskrit = sa Serbian (Cyrillic) = sr Serbian (Latin) = sr Slovak = sk Slovenian = ls Sorbian = sb Spanish (Argentina) = es-ar Spanish (Bolivia) = es-bo Spanish (Chile) = es-cl Spanish (Colombia) = es-co Spanish (Costa Rica) = es-cr Spanish (Dominican Republic) = es-do Spanish (Ecuador) = es-ec Spanish (El Salvador) = es-sv Spanish (Guatemala) = es-gt Spanish (Honduras) = es-hn Spanish (International Sort) = es Spanish (Mexico) = es-mx Spanish (Nicaragua) = es-ni Spanish (Panama) = es-pa Spanish (Paraguay) = es-py Spanish (Peru) = es-pe Spanish (Puerto Rico) = es-pr Spanish (Traditional Sort) = es Spanish (United States) = es-us Spanish (Uruguay) = es-uy Spanish (Venezuela) = es-ve Sutu = sx Swahili = sw Swedish (Finland) = sv-fi Swedish = sv Syriac = syr Tamil = ta Tatar = tt Telugu = te Thai = th Tsonga = ts Tswana = tn Turkish = tr Ukrainian = uk Urdu = ur Uzbek (Cyrillic) = uz Uzbek (Latin) = uz Vietnamese = vi Xhosa = xh Yiddish = yi Zulu = zu
or use time settings by lang. (edit each lang)
<? if(eregi('en-US', $HTTP_USER_AGENT)) {$thistime = date("H")+1;} if(eregi('en-GB', $HTTP_USER_AGENT)) {$thistime = date("H")+8;} else {$thistime = date("H");} echo'"'.$thistime.'" Is this close to your time?'; ?>Hi JayaShanka Below i given Time Php script. Create time.php page. And Chmod to 755. include this php script in your index page. any doubt pls contact to me on admin@teluguwap.com
CODE<?php
$TimeZone="0"; ////Change the TimeZone accordingly! $New_Time = time() + ($TimeZone * 60 * 60);
$show_date=date("D d/m/Y",$New_Time); $show_time=date("g:i:s a",$New_Time); $Hour=date("G",$New_Time);
echo $show_date; echo" "; echo $show_time; echo" ";
////////////////Here you can change the messages, add lines with different hours etc. You could even display a different message every hour.////////////////
if ($Hour <= 4) { echo 'Hello night owl!'; }
else if ($Hour <= 11) { echo 'Good morning!'; }
else if ($Hour <= 12) { echo 'Enjoy your lunch!'; }
else if ($Hour <= 17) { echo 'Good afternoon!'; }
else if ($Hour <= 23) { echo 'Good Evening!'; }
?>
time.php script is a easily available script here it is