Gmt +1 London england

General discussions related to php

Moderators: macek, egami, gesf

zeusthegreat
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Apr 29, 2013 3:09 am

Gmt +1 London england

Postby zeusthegreat » Mon Apr 29, 2013 3:32 am

time.php

<?php

include("conf.php");
function getlang($language, $charset) {
global $lang;
global $diff;
global $char;
if (!isset($lang) || empty($lang) || $lang == "false") {
$found_lang[0] = strtolower(substr($language,0,3)) . '_' . strtoupper(substr($language,0,3));
$found_lang[1] = strtolower(substr($language,0,3)) . '-' . strtoupper(substr($language,0,3));
$found_lang[2] = strtolower(substr($language,0,2)) . '_' . strtoupper(substr($language,0,2));
$found_lang[3] = strtolower(substr($language,0,2)) . '-' . strtoupper(substr($language,0,2));
} else {
$found_lang[0] = strtolower(substr($lang,0,3)) . '_' . strtoupper(substr($lang,0,3));
$found_lang[1] = strtolower(substr($lang,0,3)) . '-' . strtoupper(substr($lang,0,3));
$found_lang[2] = strtolower(substr($lang,0,2)) . '_' . strtoupper(substr($lang,0,2));
$found_lang[3] = strtolower(substr($lang,0,2)) . '-' . strtoupper(substr($lang,0,2));
}
if (!isset($char) || empty($char) || $char == "false") {
$char = $charset;
}
$lang = array($found_lang[0],$found_lang[1],$found_lang[2],$found_lang[3]);
if (function_exists('mb_convert_encoding')) {
setlocale(LC_ALL, $lang);
$date = ucwords(strftime("%A, %d %B %Y")) . " " . gmdate ("H:i:s", time() + $diff );
$time = mb_convert_encoding($date, "$char");
} else {
setlocale(LC_ALL, $lang);
$time = ucwords(strftime("%A, %d %B %Y")) . " " . gmdate("H:i:s", time() + $diff);
}
echo $time;
}
?>


above is my time script I do not fully understand it yet, I included this file into my index.php page where in the footer I wish to display GMT +1 London England aswell as the date

conf.php

?php

$lang = "eng"; // Put your language or put false
// For example: "eng" or "ita" or "deu" or "fra"... or "false"
$char = "ISO-8859-1"; // Put your charset or put false
// For example: "UTF-8" or "ISO-8859-1"... or "false"
$diff = "+1"; // Change this with your different GMT time
?>


I thought I had got all of this right as I believe that London England is gmt +1



<?php getlang("eng","ISO-8859-1", " +1" ); ?>


I still cannot understand this

I know you can do something more simple to get the same result but I wish to learn and want to know what I have done wrong

Because even when I alter the time diff at the end I still get the same result one hour behind

I have even transfered the files into the pear file and made sure that they have been altered correctly


I know it is something easy that I have just missed but please help if you can

And in straight forward literature please

thankyou!!

oh sorry there is an error to the page aswell

Warning: include(../conf.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\drop_off_pc\include\time.php on line 3

Warning: include() [function.include]: Failed opening '../conf.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\drop_off_pc\include\time.php on line 3
I have gotten rid of these errors now but the hour is still behind

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron