FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » MySQL date time current time diffenece
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: MySQL date time current time diffenece [message #175189 is a reply to message #175188] Sun, 21 August 2011 14:15 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 8/21/2011 9:42 AM, j wrote:
> I have a timestamp in MySQL table. I want to compare that to the current
> time. I'll be using this code on different servers.
>
> I can do this:
>
> $mysql_datetime = '2011-08-19 14:00:35';
>
> $mysql_datetime_formatted = preg_replace('/\D/','',$mysql_datetime);
>
> $date_now = date("YmdHis");
>
> $diff = $date_now - $mysql_datetime_formatted;
>
> echo "$mysql_datetime_formatted - $date_now = $diff in seconds";
>
> Can I count on (more or less) the MySQL time/time zone to be the same as
> that PHP uses?
>
> More reliable or easier way?
>
> Jeff

Try asking in comp.databases.mysql - there are better ways to do it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Webhosting, Domain Name, Data Center Cyprus, Hosting Services
Next Topic: Roll SQL name value query into two-dimensional array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 18:43:33 GMT 2024

Total time taken to generate the page: 0.05986 seconds