Just a few of points before you get into vlibDate.
1) Throughout the documentation you will come across quite often the String type timestamp.
This is not a unix timestamp but a 'vlibDate timestamp'. vlibDate timestamps are simply a
string in 'YYYY-MM-DD' format, i.e. 2002-01-25. If a unix timestamp is required the unixtime
will be used as the type definition.
2) In many functions, you can define a format for the string to be returned as. This format uses
similar syntax to the native php function strftime(), however not all formats are supported.
Here is a list of the formatting options supported:
-
%a abbreviated weekday name according to the current language setting (Mon, Tue..)
-
%A full weekday name according to the current language setting (Sunday, Monday, Tuesday...)
-
%b abbreviated month name according to the current (Jan, Feb, Mar)
-
%B full month name according to the current (January, February, March)
-
%d day of the month as a decimal number (range 01 to 31)
-
%e day of the month as a decimal number (range 1 to 31)
-
%E number of days since unspecified epoch (integer).
(%E is useful for storing a date in a Db/Session ..etc as an integer value.
Then use daysToDate() to convert back to a date.)
-
%j day of the year as a decimal number (range 001 to 366)
-
%m month as decimal number (range 01 to 12)
-
%n newline character
-
%s ordinal suffix for day of month
-
%t tab character
-
%U week number of current year as a decimal number, starting with the first
Sunday as the first day of the first week.
-
%W week number of current year as a decimal number, starting with the first
Monday as the first day of the first week.
-
%w weekday as decimal (0 = Sunday)
-
%y year as a decimal number without a century (range 00 to 99)
-
%Y year as a decimal number including the century (range 0000 to 9999)
-
%% literal '%'
Example
|
$date = new vlibDate('en');
echo $date->formatDate('2002-02-15', '%A %e%s of %B, %Y');
|
3) To set a default language for this class, you must edit the vlibIni.php file.