PHP Classes

File: ejemplo

Recommend this page to a friend!
  Classes of Gerardo Miguel Ballena Descalzo   Manipulate date and time   ejemplo   Download  
File: ejemplo
Role: Example script
Content type: text/plain
Description: ejemplo de utilizacion de la clase
Class: Manipulate date and time
Add and subtract a period to a date
Author: By
Last change:
Date: 18 years ago
Size: 627 bytes
 

Contents

Class file image Download
<?php
//Ejemplo de uso de clase fecha_hora

include("fecha_hora.php");

$fech = new fecha_hora(2003, 12, 4);
$fech->formato = "Y-m-d";

//obt : obtener

echo "<U>Fecha</U><BR>";
echo
"Fecha inicial: ".$fech->obt_fecha_hora()."<BR>";

$fech->adicionar_fecha(0, 0, 30);

echo
"Fecha final (se aumento 30 dias): ".$fech->obt_fecha_hora()."<BR><BR>";

$hra = new fecha_hora(0, 0, 0, 23, 59, 0);
$hra->formato = "H:i:s";

echo
"<U>Hora</U><BR>";
echo
"Hora inicial: ".$hra->obt_fecha_hora()."<BR>";

$hra->adicionar_hora(0, 62, 0);

echo
"Hora final (se aumento 62 minutos): ".$hra->obt_fecha_hora();

?>