Jump to content

Day and month change to local language.


mmarif4u

Recommended Posts

Hi to all.

I am trying to change my site date and time to local language.

For example:

sunday march 15 2008

to

Isnin marc 15 2008.

How can i do this without getting help from host.

I mean in php,make any function some thing like that.

OR any link to follow.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/96264-day-and-month-change-to-local-language/
Share on other sites

As far as i'm aware, you have no option but to write a function:

 

<?php
function localdate(){
    //replace with local names
    $days = array('Sunday','Monday','Tuesday','Wednesday','Thusday','Friday','Saturday');
    $months = array('January','February','March','April','May','June','July','August','September','October','November','December');
    list($day,$month,$date,$year) = explode(' ',date('w n j Y'));
    $day = $days[$day];
    $month = $months[$month - 1];
    return $day.' '.$month.' '.$date.' '.$year;
}
echo localdate();
?>

 

Edit: Perhaps not. If your language is one that is supported, this may be of some use:

 

http://uk3.php.net/manual/en/function.setlocale.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.