CodeIgniter Forums

Full Version: change date format
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]persian empire[/eluser]
Hi. Friends
i have an application that is wrote by Codeigniter . i want to change all dates in this script with persian calendar (known as "hijri calendar") . I found the multi calendar from http://codeigniter.com/wiki/Calendar/
but i don't know ho to use it . please help me .
Best Regards

El Forum

[eluser]persian empire[/eluser]
I want when i use date(); function it shows persian calendar not default gregorian .
please if anyone know this answer me .
thank you

El Forum

[eluser]danmontgomery[/eluser]
I don't know what the difference between the persian and gregorian calendars are, but you should be able to use setlocale() for date and time formatting.

El Forum

[eluser]persian empire[/eluser]
thank you for reply but setlocal does not helped me . i want to use this code : please say me how . in the wiki page of multi calendar there is not good sample .
multi calendar file is attached .
please say me where i should copy them and how use it in my code .

El Forum

[eluser]persian empire[/eluser]
i have this function too . it is in zip file .

El Forum

[eluser]persian empire[/eluser]
No Idea ? anyone can't help me ?

El Forum

[eluser]danmontgomery[/eluser]
There's a sample controller in multi_calendar.zip:

Code:
class Blog extends Controller {

       function Blog()
       {
            parent::Controller();
       }
      
       function test() {
         $config=array("base_calendar"=>"persian");
        
         $this->load->library('Calendar',$config);
         echo $this->calendar->generate();
       }
}

For some reason it was written to replace the core calendar library rather than extend it, so you would have to put these in ./system/libraries

El Forum

[eluser]persian empire[/eluser]
I'm newbie to php .
please give me a complete sample to use this controller in my code.
i want to date() return the persian date not gregorian .
i have this code :
Code:
<?=date('H:m', strtotime($news->news_created))?>
i want to convert in to persian date

El Forum

[eluser]danmontgomery[/eluser]
[quote author="persian empire" date="1268426297"]I'm newbie to php .
please give me a complete sample to use this controller in my code.
i want to date() return the persian date not gregorian .[/quote]

Doesn't work that way, sorry.

El Forum

[eluser]persian empire[/eluser]
[quote author="noctrum" date="1268426450"][quote author="persian empire" date="1268426297"]I'm newbie to php .
please give me a complete sample to use this controller in my code.
i want to date() return the persian date not gregorian .[/quote]

Doesn't work that way, sorry.[/quote]
i know this not possible but i can replace date function /