dev.obliquid.com: general
[ class tree: general ] [ index: general ] [ all elements ]

Class: Date

Source Location: Program_Root/classes/general/date.php

Class Overview


Date formatting class.


Methods


Inherited Variables

Inherited Methods


Class Details

[line 18]
Date formatting class.

A Date object has to be initialized with a date, this date may be displayed in many formats. Each Date object holds one date value, it may be changed using the provided methods. You may have better options to handle multilingual dates, check out strftime() function in the PHP documentation. This class supports many european languages: Italian (it), English (en), Spanish (es), French (fr) and German (de)






[ Top ]


Class Methods


method addDays [line 310]

void addDays( mixed $days)

adds a number of days to the date





[ Top ]

method date [line 92]

void date( [int $initvalue = 0], [string $lang = "en"])

constructor: initialize the class by assigning a date and a language





Parameters:

int   $initvalue   an unix timestamp, or a date in ISO format (yyyy-mm-dd) if contains hyphen "-" or date in italian format (dd/mm/yyyy) if contains slash "/"
string   $lang   supported languages: it, en, de, es, fr, default en

[ Top ]

method getDate [line 150]

string getDate( )

gets a textual, long formatted date, according to the language setting





[ Top ]

method getDay [line 233]

int getDay( )

gets the day of the month of the date. Ex. 19





[ Top ]

method getDayOfWeek [line 241]

int getDayOfWeek( )

returns day of the week ordinal of the date. Ex. 2.

0=Sunday, 6=Saturday






[ Top ]

method getDayOfWeekName [line 248]

string getDayOfWeekName( )

Returns day of the week name of the date. Ex. Sunday





[ Top ]

method getDaysinMonth [line 279]

int getDaysinMonth( [int $month = 0])

gets the number of days in a month. Ex. 31





Parameters:

int   $month   month 1-12, if not specified uses month of the date

[ Top ]

method getItaDate [line 178]

string getItaDate( )

gets a date in dd/mm/yyyy format



Tags:

return:  date in Italian format


[ Top ]

method getLang [line 143]

char(2) getLang( mixed $lang)

gets the language as a two char string: Ex. en, es, de, fr, it





[ Top ]

method getMonth [line 256]

string getMonth( )

gets the month (01-12)

returns a two chars, zero padded numerical string of the month






[ Top ]

method getMonthName [line 271]

string getMonthName( )

gets the full textual month name, in the setted language.



Tags:

return:  - month name, ex. January


[ Top ]

method getMyDate [line 203]

string getMyDate( )

gets the date in MySQL format yyyy-mm-dd



Tags:

return:  date formatted for mysql


[ Top ]

method getTimestamp [line 116]

int getTimestamp( )

gets the unix timestamp, number of seconds since 1/1/1970





[ Top ]

method getYear [line 303]

int getYear( )

gets the year of the date, 4 digit (YYYY).





[ Top ]

method setDay [line 226]

void setDay( int $day)

sets the day of the month of the date (01-31)





Parameters:

int   $day   day of the month

[ Top ]

method setItaDate [line 190]

void setItaDate( $itadate $itadate)

sets the date using the Italian short format dd/mm/yyyy - d/m/yyyy is also accepted. It's better to use 4 digits year, but works with 2 digits too, as explained in setYear().



Tags:

see:  Date::setYear()


Parameters:

$itadate   $itadate   string italian short format date

[ Top ]

method setLang [line 126]

void setLang( string $lang)

sets the language.

if the lang is not in the list of supported languages defaults silently to english.






Parameters:

string   $lang   one of: it, en, de, es, fr

[ Top ]

method setMonth [line 264]

void setMonth( int $month)

sets the month (1-12)





Parameters:

int   $month  

[ Top ]

method setMyDate [line 213]

void setMyDate( string $mydate)

sets the date using mysql format yyyy-mm-dd. if the date is not valid, sets to 1/1/1970. 0-0-0 means today.





Parameters:

string   $mydate  

[ Top ]

method setTimestamp [line 109]

void setTimestamp( int $timestamp)

changes the date to the given timestamp, seconds since 1/1/1970.





Parameters:

int   $timestamp   an unix timestamp

[ Top ]

method setYear [line 294]

void setYear( int $year)

sets the year in the date, 4 digit (YYY).

Month and Day are left unchanged to the previous value. if you use 2 digit year then 0-69 is mapped to 2000-2069 and 70-99 to 1970-1999. whenever you can, use 4 digit year.






Parameters:

int   $year   year

[ Top ]

method setYMD [line 171]

void setYMD( int $year, int $month, int $day)

sets year, month and day for the date. It's better to use 4 digits year, but works with 2 digits too, as explained in setYear().



Tags:

see:  Date::setYear()


Parameters:

int   $year  
int   $month  
int   $day  

[ Top ]


Documentation generated on Tue, 29 Mar 2005 09:03:47 -0800 by phpDocumentor 1.2.0rc2