Welcome Guest, Not a member yet? Register   Sign In
DateUtilsLib : A simple date Lib to use with Code Igniter for local dates manipulations
#1

[eluser]Unknown[/eluser]
DateUtilsLib
Name: DateUtilsLib 1.0
Released: Feb 19, 2012
CI Version: Tested with CodeIgniter 2.1.0
Author: Stéphane Bourzeix

ChangeLog:
Changed default functions to return current date.
Added French as datefr.
Added Spanish as datees.
The DateUtilsLib is a very simple Code Igniter Lib to help you to format Dates in correct language and local format. The idea is to avoid to have to rely on Php Locale implementation to display correctly dates in various languages. The DateUtilsLib function will work just with a simple Timestamp provided.

Installation and configuration:
Copy DateUtils.php to your application/libraries directory.

Currently supported languages:
French: Use datefr()
Spanish: Use datees()
Usage:

// load the library
Code:
$this->load->library('dateutils');

Function has 4 params:
- timestamp: date/time (UNIX format)
- modejour: l:long (lundi 23) ; cConfusedhort (lun 23) ; n:day number (23) ; h:nothing
L or C in Caps puts the first letter of the day in Caps (ex C : Lun)
- modemois: l:long (septembre) ; cConfusedhort (sept) ; n:number (09) ; h:nothing
L or C in Caps puts the first letter of the day in Caps (ex C : Lun)
- modeheure: l:long (7 heures 35) ; cConfusedhort (7h35) ; n:nothing

If you don't provide the TimeStamp or any param it will still display the
current date abbr in the correct format of the correct language

Examples :
Code:
$this->load->library('dateutils');

Code:
echo $this->dateutils->datefr() =   27/04/1980
echo $this->dateutils->datefr(325689845,'C','L','n');   =   Dim 27 Avril 1980
echo $this->dateutils->datefr(325689845,'n','c','n');   =   27 avr 1980
echo $this->dateutils->datefr(325689845,'l','n','l');   =   dimanche 27/04/1980 7 heures 35
echo $this->dateutils->datefr(325689845,'h','h','l');   =   7 heures 35

Get it here : https://github.com/DaBourz/DateUtilsLib


Messages In This Thread
DateUtilsLib : A simple date Lib to use with Code Igniter for local dates manipulations - by El Forum - 06-12-2012, 01:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB