Re: [PHP] time() question

2003-03-13 Thread Ernest E Vogelsinger
At 18:07 13.03.2003, Tom Ray said:
[snip]
>Is there an easy way to display the epoch time given by time() in a human
>readable format? Basically, if I do $time = time(); and the insert that
>data into my mysql database and then pull that information out again how
>do I make it look like 2003-03-13 or a variant of that?
[snip] 

http://www.php.net/manual/en/function.date.php


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] time() question

2003-03-13 Thread Tom Woody
On Thu, 13 Mar 2003 12:07:33 -0500
"Tom Ray" <[EMAIL PROTECTED]> wrote:

> Is there an easy way to display the epoch time given by time() in a
> human readable format? Basically, if I do $time = time(); and the
> insert that data into my mysql database and then pull that information
> out again how do I make it look like 2003-03-13 or a variant of that?
> 
in php you would do: (see
http://www.php.net/manual/en/function.date.php)
$date = date('Y-m-d',time());

in mysql you would do:
(http://www.mysql.com/doc/en/Date_and_time_functions.html)
select date_format('%Y-%m-%d', field) from table where ...;


-- 
Tom Woody
Systems Administrator

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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



Re: [PHP] time() question

2003-03-13 Thread Larry E. Ullman
Is there an easy way to display the epoch time given by time() in a 
human
readable format? Basically, if I do $time = time(); and the insert that
data into my mysql database and then pull that information out again 
how
do I make it look like 2003-03-13 or a variant of that?
If you are pulling a date/time out of a MySQL database, use MySQL's 
DATE_FORMAT() function to format the value. For that matter, you can 
use MySQL's NOW() function (or others) when inserting the time.

Otherwise, just in PHP, you can use the DATE() function to format dates.

Larry

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


[PHP] time() question

2003-03-13 Thread Tom Ray
Is there an easy way to display the epoch time given by time() in a human
readable format? Basically, if I do $time = time(); and the insert that
data into my mysql database and then pull that information out again how
do I make it look like 2003-03-13 or a variant of that?

TIA


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



Re: [PHP] time question.

2002-07-26 Thread 1LT John W. Holmes

> How do I compare time in php?
>
> Eg. If I have a mysql time field I retrieve stored in $result[0][0] how do
I
> say :
>
> if (($result[0][0] > $result[0][0] plus ten minutes) && ($result[0][0] >
> '00:00:00')){

MySQL and PHP timestamps are in different formats. MySQL uses MMDDHHMMSS
and PHP uses a unix timestamp, the number of seconds since January 1st,
1970.

You can use UNIXTIMESTAMP(your_column) in your query to get a PHP style unix
timestamp.

Although, if you explain what you are trying to do a little better, you
could probably do the comparisons a lot easier in your query and not involve
PHP at all.

SELECT * FROM your_table WHERE your_column > your_column + INTERVAL 10
MINUTE AND your_column != 0

That looks equivilent to what you're trying to do in PHP. You might have to
say your_column+0 != 0 to get your_column as an integer and not a string.

---John Holmes...


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




RE: [PHP] time question

2002-03-30 Thread J. Scott Johnson

Why wouldn't you use gmdate: 

http://www.php.net/manual/en/function.gmdate.php

and then increment it yourself by an offset?

Scott

-Original Message-
From: anders nawroth [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 30, 2002 5:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] time question


How do I get the current time() for Central European Time
(= GMT +01:00).
I want it to work wherever the server stands.
How can I get the difference between server time
and GMT, for instance?

A. Nawroth



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



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




[PHP] time question

2002-03-30 Thread anders nawroth

How do I get the current time() for Central European Time
(= GMT +01:00).
I want it to work wherever the server stands.
How can I get the difference between server time
and GMT, for instance?

A. Nawroth



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