Re: About date & time...

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

 




----- Original Message ----- From: "tedd" <tedd@xxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>; "Gustav Wiberg" <gustav@xxxxxxxxxxxxxx>
Sent: Tuesday, February 28, 2006 4:17 PM
Subject: Re:  About date & time...


>Thanx for your input about date & time...

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

function currenttime() {

-snip- lot's of code.

Hi Gustav:

Not meaning to embarrass, but your code could be shortened considerably by using date(), like so:

Your lengthy  -- function currenttime()

can be replaced simply with:

   echo("Date: " . date('Y\-\ m\-\ d') . "<br/>" );

and your -- function currentdate()

can be replaced with:

    echo("Time: " . date('h\:\ i\:\ s') . "<br/>" );

If you don't like the spaces in the output, then strip them out, like so:

    $date = date('Y\-\ m\-\ d');
    $date = str_replace(" ", "", $date);
    echo("Date: " . $date. "<br/>" );

and

    $date = date('h\:\ i\:\ s') ;
    $date = str_replace(" ", "", $date);
    echo("Time: " . $date. "<br/>" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0


tedd

--
--------------------------------------------------------------------------------
http://sperling.com

Hi there!

Not meaning to embarrass, but your code could be shortened considerably by using date(), like so:
*hehe* It's all okey, it was something like this you're typing that I was searching for, but couldn't find it exactly as I wanted. Thanx a lot!!! :-) I really appreciate it!

/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