Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
The stupid question is the question not asked
 
PerlMonks  

Re: MySQL Timestamp comparison

by dbwiz (Curate)
on Oct 30, 2003 at 08:01 UTC ( [id://303243]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to MySQL Timestamp comparison

You can see MySQL timestamps as numbers.

my $query = "SELECT timestampColumn FROM mytable LIMIT 1"; my $sth = $dbh->prepare($query); $sth->execute(); while (my $row = $sth->fetchrow_arrayref()) { my $TS = $row->[0]; print "$TS ", $TS + 1, " ", $TS + 10, "\n"; } __END__ 20030524183051 20030524183052 20030524183061

Be aware, though, that timestamps in MySQL can't deal with time intervals smaller than one second. Depending on how fast is your server, you may have several thousand records with the same timestamp. Just to give you a hint, in my laptop, I managed to insert 100,000 records in 2.6 seconds. In my company's server, I did the same operation in 0.8 seconds. Of course, ALL those records have the same timestamp.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://303243]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.