Hi, simply i want to translate the date but the script do not have an option. This is the sites date codes ## RETURN DATE function return_date($date, $type) { global $session_logged, $user_info, $drup_settings; if (($date == '0') || ($date == '')) { return ''; } else { // no date input in db if ($session_logged == 'true') { $offset = strtotime($user_info['user_timezone'], $date); } else { $offset = strtotime($drup_settings['drup_timezone'], $date); } return gmdate("d F Y h:i A" ,$offset); } } ## TODAYS DATE function date_time($type) { if ($type == 'date') { return date('D dS M Y'); } else if ($type == 'datetime') { return date('jS M Y \a\t\ H.i'); } else if ($type == 'forums') { return date('D M j, Y H.i'); } else if ($type == 'short') { return date('d-m-y | G:i'); } } PHP: And this is the code about my language <? $saat_farki = "24"; $eklenti = ($saat_farki * 3600)+time(); $gunler=array("Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cumartesi"); $aylar=array("Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"); $turkce_gun=$gunler[date("w", $eklenti)]; $turkce_ay=$aylar[date("n", $eklenti)]; $gun=date("j", $eklenti); $yil=date("Y", $eklenti); $saat=date("G:i:s", $eklenti); $turkce_tarih="$gun $turkce_ay $yil, $turkce_gun, $saat"; echo $turkce_tarih; ?> PHP: $eklenti is $offset- Anyone can adapt this, i cant.If you have time please help me.
For the month you could try something like the following (I don't know if this is the easiest method); <?php function translate_month($month){ $month_array = array('Janurary'=>"Ocak",'February'=>"Åžubat",'March'=>"Mart", etc and so on); return $month_array[$month]; } ?> Code (markup): then when you're displaying the month you output; <?php print translate_month($month); ?> Code (markup): I don't know what your PHP skills are like but you may need to break up the date string returned by the functions you mentioned in the first block of text and you can do so with a function such as explode().
Is that... turkish? (ooh, I'm rusty at other languages) What you are looking for is the setlocale function. setlocale(LC_TIME, 'turkish','tr_TR','tr'); All dates/times from that point on would/should be shown in turkish. http://us3.php.net/manual/en/function.setlocale.php So you don't need to write a function to do this, php has one built in.
Thanks a lot my friend.I am really grateful for your time and effort, this is not a standart thank you.) I give tons of my time but i cant fix it.I found codes like i gave, they are working nice like your code.Try your code and it works great.But, my main problem is adapt it to my script.I have to modify because it gives on forum, pool etc the time.So i cant use print translate_month($month); in script i have modify this part. ## TODAYS DATE function date_time($type) { if ($type == 'date') { return date('D dS M Y'); } else if ($type == 'datetime') { return date('jS M Y \a\t\ H.i'); } else if ($type == 'forums') { return date('D M j, Y H.i'); } else if ($type == 'short') { return date('d-m-y | G:i'); } } PHP: Anyway thanks a lot again, i will asist this problem to hostgators support This likes magic, setlocale(LC_TIME, 'turkish','tr_TR','tr'); .Like it a lot my friend and i am really thanks like my friend above.This is good and i hope it works it on Hostgator, also, the support team can modify my script because i do not know where will i place this command.(Yes i am not good at php .) And yes, this is Türkçe (Turkish) my friend.Hi from Turkey.)
Deathshadows version is by far the simplest solution. Try putting his line of code at the start of this function; function date_time($type) { // IN HERE ****<*<*<*<*<*<*<*< if ($type == 'date') { return date('D dS M Y'); } else if ($type == 'datetime') { return date('jS M Y \a\t\ H.i'); } else if ($type == 'forums') { return date('D M j, Y H.i'); } else if ($type == 'short') { return date('d-m-y | G:i'); } } PHP: