Re: About date & time...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't understand! Why don't u use date function and just format it as u want?

Andy

Gustav Wiberg wrote:
Hi

Thanx for your input about date & time...

Here's some functions that worked for me after some searching...


function currenttime() {

$today = getdate();

$ithours = $today["hours"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itminutes = $today["minutes"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itseconds = $today["seconds"];
if (intval($itseconds)<10) {
 $itseconds = "0" . $itseconds;
}


$it = $ithours . ":" . $itminutes . ":" . $itseconds;
return $it;
}

function currentdate() {

$today = getdate();

$idyear = $today["year"];
if (intval($idyear)<10) {
 $idyear = "0" . $idyear;
}

$idmonthnr = $today["mon"];
if (intval($idmonthnr )<10) {
 $idmonthnr  = "0" . $idmonthnr ;
}

$idmonthday = $today["mday"];
if (intval($idmonthday)<10) {
 $idmonthday = "0" . $idmonthday;
}


$id = $idyear . "-" . $idmonthnr . "-" . $idmonthday;
return $id;

}

$insertTime = currenttime();
$insertDate = currentdate();



/G


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux