PHP Date Functions

Funcion Descripcion Sintaxis
checkdate() Validates a Gregorian date checkdate(month,day,year);
date_add() Adds days, months, years, hours, minutes, and seconds to a date date_add(object,interval);
date_create_from_format() Returns a new DateTime object formatted according to a specified format date_create_from_format(format,time
,timezone);
date_create() Returns a new DateTime object date_create(time,timezone);
date_date_set() Sets a new date date_date_set(object,year,month,day);
date_default_timezone_get() Returns the default timezone used by all date/time functions date_default_timezone_get();
date_default_timezone_set() Sets the default timezone used by all date/time functions date_default_timezone_set(timezone);
date_diff() Returns the difference between two dates date_diff(datetime1,datetime2,absolute);
date_format() Returns a date formatted according to a specified format date_format(object,format);
date_get_last_errors() Returns the warnings/errors found in a date string date_get_last_errors();
date_interval_create
_from_date_string()
Sets up a DateInterval from the relative parts of the string
date_interval_format() Formats the interval DateInterval::format(format);
date_isodate_set() Sets the ISO date date_isodate_set(object,year,week,day);
date_modify() Modifies the timestamp date_modify(object,modify);
date_offset_get() Returns the timezone offset date_offset_get(object);
date_parse_from_format() Returns an associative array with detailed info about a specified date, according to a specified format date_parse_from_format(format,date);
date_parse() Returns an associative array with detailed info about a specified date date_parse(date);
date_sub() Subtracts days, months, years, hours, minutes, and seconds from a date date_sub(object,interval);
date_sun_info() Returns an array containing info about sunset/sunrise and twilight begin/end, for a specified day and location date_sun_info(timestamp,latitude,longitude);
date_sunrise() Returns the sunrise time for a specified day and location date_sunrise(timestamp,
format,latitude,longitude,zenith,gmtoffset);
date_sunset() Returns the sunset time for a specified day and location date_sunset(timestamp,
format,latitude,longitude,zenith,gmtoffset);
date_time_set() Sets the time date_time_set(object,hour,minute,second);
date_timestamp_get() Returns the Unix timestamp date_timestamp_get(object);
date_timestamp_set() Sets the date and time based on a Unix timestamp date_timestamp_set(object,unixtimestamp);
date_timezone_get() Returns the time zone of the given DateTime object date_timezone_get(object);
date_timezone_set() Sets the time zone for the DateTime object date_timezone_set(object,timezone);
date() Formats a local date and time date(format,timestamp);
getdate() Returns date/time information of a timestamp or the current local date/time getdate(timestamp);
gettimeofday() Returns the current time gettimeofday(return_float);
gmdate() Formats a GMT/UTC date and time gmdate(format,timestamp);
gmmktime() Returns the Unix timestamp for a GMT date gmmktime(hour,minute
,second,month,day,year,is_dst);
gmstrftime() Formats a GMT/UTC date and time according to locale settings gmstrftime(format,timestamp);
idate() Formats a local time/date as integer idate(format,timestamp);
localtime() Returns the local time localtime(timestamp,is_assoc);
microtime() Returns the current Unix timestamp with microseconds microtime(get_as_float);
mktime() Returns the Unix timestamp for a date mktime(hour,minute,second,
month,day,year,is_dst);
strftime() Formats a local time and/or date according to locale settings strftime(format,timestamp);
strptime() Parses a time/date generated with strftime() strptime(date,format);
strtotime() Parses an English textual datetime into a Unix timestamp strtotime(time,now);
time() Returns the current time as a Unix timestamp time();
timezone_abbreviations_list() Returns an associative array containing dst, offset, and the timezone name timezone_abbreviations_list();
timezone_identifiers_list() Returns an indexed array with all timezone identifiers timezone_identifiers_list(what,country);
timezone_location_get() Returns location information for a specified timezone timezone_location_get(object);
timezone_name_from_ abbr() Returns the timezone name from abbreviation timezone_name_from_
abbr(abbr,gmtoffset,isdst);
timezone_name_get() Returns the name of the timezone timezone_name_get(object);
timezone_offset_get() Returns the timezone offset from GMT timezone_offset_get(object,datetime);
timezone_open() Creates new DateTimeZone object timezone_open(timezone);
timezone_transitions_get() Returns all transitions for the timezone
timezone_version_get() Returns the version of the timezone db timezone_version_get();



۩_ Inicio
─►Siguiente Ejercicio
◄─Anterior Ejercicio