.: Code Index :.
[Expand Java Archive]Java
PHP
Classes
noFormDate
Usage
Readme
ToDo
Changelog
Download
I wrote the noFormDate Class because i lacked an easy way of doing date-stuff in forms via drop-boxes and I hope you will have some use for it as well...

First you want to include the class-file like this:
     include("noFormDate.class.php");

Or if you have it in another location that requires a full path:
     include("/full/Path/to/noFormDate.class.php");

Then, you may want to make use of the class in your code:
This makes $noFormDate able to access the FormDate Class.
noFDyear($ID, $TIMESTAMP); = This creates a dropdown-box with the current year selected. It starts X years before, and ends X years after current year. Defualt is 5 years. Changable in the class-file to suit your needs.

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

$TIMESTAMP = A standard unix timestamp in seconds. Current time is time().

Example:
$noFormDate->noFDyear("1", time());
noFDmonth($ID, $TIMESTAMP, $SHORT, $LANG); = This creates a dropdown-box January to December with the current month selected. Can easily be customized for your language in the class-file.

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

$TIMESTAMP = A standard unix timestamp in seconds. Current time is time().

$SHORT = Allows for full or abbrevated month-names. Values is: 'yes' and 'no'. Default: 'no'.

$LANG = What language you want to use to print the month in. Default is English ('en').

Example:
$noFormDate->noFDmonth("1", time(), "no", "en");
$noFormDate->noFDmonth("2", time(), "no", "sv");
$noFormDate->noFDmonth("3", time(), "yes", "en");
$noFormDate->noFDmonth("4", time(), "yes", "sv");
Note: I have to use different ID's above becaus i use four month-dropboxes in one form...
These languages are available:
English "en"
Swedish "sv"
noFDday($ID, $TIMESTAMP); = This creates a dropdown-box 01 to 31.

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

$TIMESTAMP = A standard unix timestamp in seconds. Current time is time().

Example:
$noFormDate->noFDday("1", time());
noFDhour($ID, $TIMESTAMP); = This creates a dropdown-box 00 to 23.

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

$TIMESTAMP = A standard unix timestamp in seconds. Current time is time().

Example:
$noFormDate->noFDhour("1", time());
noFDminute($ID, $TIMESTAMP); = This creates a dropdown-box 00 to 59.

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

$TIMESTAMP = A standard unix timestamp in seconds. Current time is time().

Example:
$noFormDate->noFDminute("1", time());
noFDsecond($ID, $TIMESTAMP); = This creates a dropdown-box 00 to 59.

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

$TIMESTAMP = A standard unix timestamp in seconds. Current time is time().

Example:
$noFormDate->noFDsecond("1", time());
noFDmakeTime($ID); = This makes you a nice number of seconds for use or storage.
Does the same as time(), but with your own values and is created with mktime().

$ID = The ID allows you to use the FormDate multiple time within the same form. Just use a uniqe ID for every set of dropboxes you use.

The noFDmakeTime() function uses a "return" statement so you can use the result in your own code, and must be called with print($NoFormDate->noFDmakeTime($ID)); to be visible (printed in text) as i have done below.

If any of the drop-boxes are missing in the $_POST-variable, time() is used as reference.
This is by design, so you don't have to fiddle with hidden fields to make it work.

Example:
$noFormDate->noFDmakeTime("1"); 1218141351
This "Try-it-yourself" box uses the input from all above drop-boxes that is called with ID = 1.

$noFormDate->noFDmakeTime("1");
FormResult is: 1218141351 (2008-8-7 22:35:51) Now is: 2008-8-7 22:35:51 (1218141351)