Re: About date & time...

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

 



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
OMG >_<

There are lotsa functions like date and so

Also > $idmonthday = "0" . $idmonthday; < This is totally crap >_<

Therefor is the sprintf function ...

I know it works, but well. if noone wants to check the manual for better functions.. Your choice

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
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