Functions for working with dates and times

checkdate(month, day, year)

month – $integer (1-12)

day – $integer (1-31, varies)

year – $integer (1-32767)

Checks the validity of the given date, returning TRUE if it is valid.

Example:

var_dump( checkdate(2, 29, 2006) );

bool(false)

var_dump( checkdate(2, 29, 2008) );

bool(true)

date(format [, timestamp])

format – $string

timestamp – [optional] $integer default: time(), current Unix timestamp

Returns the current date and/or time based on formatting specified in format.

If timestamp is not included, the current time is used, supplied by the time()

time() – Get the current Unix timestamp, time since Unix Epoch

strtotime() - Convert a common language string to a Unix timestamp

gmdate(format [, timestamp]) Returns the current date and/or time based on formatting specified in format

returned in GMT/UTC.

mktime([, hour] [, minute] [, second] [, month] [, day] [, year] [, dst_flag])

Returns the current Unix timestamp in seconds since the Unix Epoch (January 1st , 1970, 00:00:00 GMT) as an integer. However, it takes optional arguments for a specific date/time. Optional arguments can be left off from right to left, anything not included will default to the current date/time.

 

Form Validation required. Isset () function

The isset () function is used to check whether a variable is set or not. If a variable is already unset with unset() function, it will no longer be set. The isset() function return false if testing variable contains a NULL value.

isset($variable [, ...$variable...])

Accepts multiple $variables separated by commas, but will only return TRUE if all variables are set

Determine whether $variable has been set/created/declared.

Example:

$string = '';

$integer = 0;

var_dump( isset($string,$integer) ); // True because BOTH are set

echo '<br />'; // XHTML break for new line

unset($string); // unset or destroy the variable

var_dump( isset($string), isset($integer) );

bool(true)

bool(false) bool(true)

unset() – Destroy/delete a variable or multiple variables

unset($variable [, ...$variable...])

Accepts multiple $variables separated by commas

Unsets or destroys/deletes the given $variable(s).

Example:

$string = 'hello';

var_dump( isset($string) ); // Check if it is set

echo '<br />'; // XHTML break for new line

unset($string);

var_dump( isset($string) ); // Check again

bool(true)

bool(false)