Re: About date & time...
| From: | Andrei | Date: | Tue, 28 Feb 2006 14:00:02 +0000 |
| Subject: | Re: About date & time... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231201@lists.php.net to get a copy of this message | ||
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