note 23055 added to function.time
| From: | mptrex at hotmail dot com | Date: | Mon, 08 Jul 2002 12:27:18 +0000 |
| Subject: | note 23055 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32733@lists.php.net to get a copy of this message | ||
Aquí van unas cuantas funciones para trabajar con TimeStamps y fechas. Yo las uso para fechas al
estilo español.
ts2Fecha.
De TimeStamp --> dia/mes/año
function ts2Fecha ($ts) {
return @date("d/n/Y",$ts);
}
ts2FechaCorta.
TimeStamp --> dia/mes
function ts2FechaCorta ($ts) {
return @date("d/n",$ts);
}
fecha2Ts.
dia/mes/año --> TimeStamp
function fecha2Ts ($cadena) {
if ($cadena) {
$vec = explode("/",$cadena);
return mktime(0,0,0,$vec[1],$vec[0],$vec[2]);
}
else {
return 0;
}
}
--
http://www.php.net/manual/en/function.time.php
http://master.php.net/manage/user-notes.php?action=edit+23055
http://master.php.net/manage/user-notes.php?action=delete+23055
http://master.php.net/manage/user-notes.php?action=reject+23055