Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Add Seconds To Current Time


I am trying to create a statment to add a given time in second to the current time like this:

update tags.triggers set next_interval=(addtime(curtime(),300)) where id=1;

This statment adds 3 minutes to the current time. How can I add 300 seconds to the current time?




View Complete Forum Thread with Replies

Related Forum Messages:
Compare Time Posted With Current Time Not Working
May I know how to get records with interval of 1 hour in database where the posting time is in this format '2008-05-15 00:10:40'

I tried with this :

$query="SELECT date,name FROM message WHERE (timediff(date,NOW())<=CRUDATE() CURTIME())";

But is not working. May I know what is the correct way of doing it?

View Replies !
Is It Possible To Bypass 30 Seconds Time Out
hello im importing quite a large amount of .sql scripts into mysql and everytime i get this error

Fatal error: Maximum execution time of 30 seconds exceeded in www.*******

is it possible to alter this default timeout to a longer timeperiod and if so how is it done,

im using MySQL v5.0.27, together with PHP v5 and phpmyadmin v2.9.03

View Replies !
Converting A TIME Field Into Seconds : Error Message
CREATE TABLE `m010` (`date` date NOT NULL, `hour` time NOT NULL, `duration` time default NULL, `cs` int(11) default NULL, `id` bigint(20) NOT NULL auto_increment,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC

the field 'duration' is in TIME format (thus 00:00:00) .. I want to convert it in seconds.

I've read that I can do something like this:

mysql> select duration, TIME_TO_SEC (m010.duration) AS 'ts' from m010 WHERE id = 736;

Problem is, I get this error :
ERROR 1305 (42000): FUNCTION m010.TIME_TO_SEC does not exist

View Replies !
Seconds Between 2 Dates - Why Does Seconds Jump By 40 Seconds?
I have a table for my sessions and basically i wanna check seconds between NOW() and when it was created.

I noticed that at every minute the seconds would jump by at least 40 seconds for every minute.

So if i created a new sesson on my site and Log NOW() into created

then i try doin SELECT (NOW() - created) AS created_sec

I was monitoring it because my site would log me out all the time. So I noticed at every minute it seems that it always jump 40seconds or more for every minute.

Here is table:...

View Replies !
Slow Log File Has Times In Whole Seconds But Mysqldumpslow Has Fractions Of Seconds?
When I look at the mysql-slow.log file itself that I've set up, it lists times in whole seconds. However, when i run mysqldumpslow to parse that same log file, it shows times in fractions of seconds. The info from mysqldumpslow seems correct, but I can't figure out where it gets its info. Where is it coming from?

View Replies !
On Record Creation Set Default Current Time
I'm trying to do what I thought would be a simple thing: I want set the values of certain columns at my database to the default current time.

I'm using this sql query to do so: ALTER TABLE DEPARTAMENTO ALTER COLUMN CRIADO SET DEFAULT CURRENT_TIMESTAMP

And I'm receiving the following error:

Comando SQL:

ALTER TABLE DEPARTAMENTO ALTER COLUMN CRIADO SET DEFAULT CURRENT_TIMESTAMP

Mensagens do MySQL :

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_TIMESTAMP' at line 1

View Replies !
Current Date & Time For Datetime Variable?
I have created a table with a variable of the type "datetime". Any one knows how to update this variable with the current date and time? The function Curdate() only updates the date, not the time.

View Replies !
Maximum Execution Time Of 300 Seconds Exceeded (was "MYSQL Error")
I have a huge database 400mb+ in size which i have exported into a .sql file. I tried to run this export script into a new database and it runs fine until three quarters into the scripts execution and the following error appears:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<br / >
<b>Fatal error</b>: Maximum execution time of 300 seconds exceeded in <b' at li ne 1
I believe this error may relate to "delayed_insert_timeout = 300". How do I increase this limit in mysql - maybe it may solve the problem but then again it may not .

Any advice is most gratefully appreciated - As you can imagine if the script runs fine for 3/4 of it and then an error appears, stating the error is on line 1, it will take me days to go through the whole script (hundreds of thousands of rows) to find the error as I assume the error does not reside on line 1 as this line would have been executed.

I am running the script on mysql 5, and via source /path/****.sql on linux.

View Replies !
Changing The Default Time Zone Of A Current Timestamp In MySQL
I have a shared host which uses the time zone MST (GMT-7), and I cannot seem to change the time zone for my own database.

What is the best way to create a timestamp field in a table that has the default value be the current time in GMT-0?

Is setting the default value of the timestamp field to "DATE_SUB(NOW(), INTERVAL -7 HOUR)"

View Replies !
How Many Seconds Query Took?
I'm sure this is one of the easiest questions to answer, but how to you know how many seconds it took to query the database? I noticed it on the command-line client and on a lot of forums.

View Replies !
Convert From Seconds To HH:MM:SS
Is there an easy way of converting a number (integer) into it's equivalent hh:mm:ss,

e.g. if the entry is 5400 then it would convert to 01:30:00 (e.g. one and a half hours).

View Replies !
Changing Value After 30 Seconds?
Is there a way to change a value after 30 seconds of it being changed? So if I change it to 1 from an external script, I want to 30 seconds later to change to 0. Is this possible without a script (or a script in sql of some sort?)?

View Replies !
Minutes & Seconds Only
I only want to store minutes & seconds for DVD chapter times, i.e., 3:10, or :24.

Should I use TIME,

View Replies !
Adding Seconds In TimeStamp
I have a table that contains an "interval" column and a timestamp column. I want to set the default value for the timestamp column to be the current timestamp plus the interval column which is a value in seconds.

View Replies !
SELECT Takes 20 Seconds
I am having trouble speeding up a SELECT statement from a table with 1,764 records.
I tried myisamchk --sort-index --sort-records=1 but this did not help (is a Primary key enough?).

Things were fine at around 1200 records but went downhill after 1700. I am using MySQL 3.23.42 on HP/UX 11.11 and PHP 4.3.4. Any tips on how to speed things up?

View Replies !
Mysql Does Not Respond For Several Seconds.
I have created a new database-driven website. I've installed php 5.1.1 and mysql 5.0
I'm working with the Mysqli connector.

Everything works fine. Except when a user starts tampering the website by continuously hitting the F5 button.

On the intro-page of the website, a lot of queries are being fired against the database. When the user hits F5 quickly for, let's say, 50 times the database times out and I get the ugly error:

"Warning: mysqli::mysqli() [function.mysqli]: (HY000/2003): Can't connect to MySQL server on 'localhost' (10048) in..."

After the database 'hangs' and I am unable to connect to it for at least 30 seconds...

Any idea why the tampering makes my database go down for a few secs ?

View Replies !
Insert Row With NOW() Plus Twenty Seconds?
Is there any way you can state in your INSERT command through mysql to add twenty or so seconds onto the NOW() function?

View Replies !
Mysql Killing The Connection After X Seconds
I'm running mysql 4.0.20a on Windows XP Pro. I have a java web
application that connects to the database for storing persistent java
classes.

I am running into a problem when I leave my application running
overnight... I try to log in to my page in the morning and it gives
me a JDBC Exception. If I restart the web server (not the mysql
server) and then try to log in to my app runs fine.

In trying to troubleshoot I've used the mysql control center to show
the processes of the mysql server and it shows that my web app doesn't
really disconnect after running a query, it just sleeps.

Does mysql kill a connection if it has been sleeping for a long time?
How do I change this? How do I find out how many seconds of sleeping
before mysql kills the connection?

View Replies !
Difference Between Two Dates Including Seconds
1) I have mySQL 3.23 installed. I have a record with two date/times fields in YYYY-MM-DD HH:MM:SS format. How do I find the difference between those two date/times? (I would also like to know it with seconds left off.)

2) Let's say I have two records each with a date/time field in YYYY-MM-DD HH:MM:SS format. How do I find the difference in date/times when each field is in a different record?

View Replies !
3 Seconds To Run A Select That Returns Empty Set?
I have recently created a very simple table with 2 VARCHAR fields. I have then created a quick php script to loop through some inserts (inserted 600000 rows) and then deleted all the rows by doing "delete from Table where field1="abc" which should delete all rows. I then did a select * from Table and the query took 3 seconds! The return result set is empty!

Later I found out that if I do a delete * from Table, without a where clause. And then after tat do a select * from Table, it will take 0.0 seconds. Why is this? How to fix?

View Replies !
Delete Inactive Sessions Every 60 Seconds?
I have a session table, where I stored user sessions in the database in a memory table. My question is, performance wise, would it be smarter to delete inactive sessions every 60 seconds via client http requests, or would it be wiser to select active sessions via a select that uses a where clause and searches a timestamp index column for active sessions, and then a cron job is scheduled to delete every 30 minutes.

Which of these would be the better choice? On each page request I am going to have to select the number of sessions that exist and a second query that displays the active users. So if I go with my second choice, I will have to include a WHERE clause that scans the index on both those queries. But if I am issuing a delete every 60 seconds, then I won't have to do that, but then the delete is taking place every 60 seconds on a client request.


View Replies !
DATETIME :: Total Elapsed Seconds
I need to find out the total elapsed seconds between two DATETIME fields.

View Replies !
Sql Error - Shuts Down The Website In 5 Seconds
There is a program called as D4 and it sends a huge data to the sql database and it slows down the website in the first 2-3 seconds and then in a few seconds it shuts down
the website until s/he stops using the program. We made a huge research over
the internet, but we couldn't find any solutions for this. It can shut down
any website, that's having a sql based database. I hope you can help us with
this problem. Thank you for your attention and time.

if the site admins want to get the program, they can contact us. However, they should be aware that this is a dangerous program so it shoudn't be distrubuted.

View Replies !
Avoid Duplicate Records In Within 30 Seconds
I'm working with php. I have a auction site, more or less. I want to create all-time rankings. The idea is to display where a seller ranks (all time) in the number of sales.

So for example, I'd display
John Doe All Time Sales Ranking: #138

I'm not exactly sure how to go about this.

$query = "SELECT count(*) as counter, SellerName FROM sales GROUP BY Sellername ORDER BY counter DESC";

This query would give me the data to list all of the Sellers in desc order by the number of sales.

In php, I could probably count until the Sellername was equal to $Sellername (already defined in their profile page), but I was hoping there would be a way to do this entirely in MySQL.


View Replies !
Every 30 Seconds -- Reconnecting After A Failed Master Event Read
Every 30 seconds -- Reconnecting after a failed master event read ....

View Replies !
DATETIME Difference In Years, Months, Days, Hours, Seconds
I am looking for a solution to compute a difference between two datetimes.

Example :
Select SEC_TO_TIME
(UNIX_timestamp('2009-2-2 10:1:2')-
UNIX_TIMESTAMP('2009-2-1 10:00:00'))

Returns 24:01:02

There is no SEC_TO_DATE nor SEC_TO_DATETIME
How could have a result like 1day 1minute 2seconds ?

View Replies !
MySQL 4.0.18 On Dual AMD64 Opteron Causing Thread Zombie Even When Timeout Is Set To 60 Seconds
We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10
for a very high volume site. We are evaluating the performance on our
new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL
4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10.

And it seems there are zombie threads. 570 threads in 1 hour and we
didn't even use JDBC connection pooling at all. These threads are
supposed to be gone within 60 seconds, since we set that option in
mysqld. Note that we run many SELECT queries (can be up to 150
queries/seconds), but the system does not indicate any slow query:
it's 0!

Our configuration is Apache 2.0.48 + Tomcat 5.0.27 + MySQL 4.0.18 with
MySQL connector/J 3.0.14 (latest stable). The Redhat 8 runs on Apache
2 + Tomcat 4.0 + MySQL 4.0.15. The old Redhat 8 on Xeon was fine. We
have another machine running Mandrake 10 on Xeon and they were fine
under the same load.

I have set the wait_timeout to 60 seconds, and it appears to be fine
within 10 minutes, all the threads that are in "sleep" mode
disappeared after 60 seconds. After a few minutes though, it's back
like it was before.

Is this Mandrake problem? MySQL problem? I read in here than Mandrake
win hands down on AMD64 compared to FreeBSD. Code:

View Replies !
PHP/MySQL Sorting By Date & Time (using Non Military Time)
This is probably a simple issue but I have searched online and can't find an answer.

I am using PHP/MySQL and I guess the most intuitive would be to have three select boxes containing HOUR / MINUTE / AM,PM option. Then store the time into mysql using there functions so I can output the data sorting them all by date and time. All the examples I have seen are for military time only but I'm sure there has got to be a simple mysql function or php function that converts non military to military and a formatting function to display with the AM / PM. But I have not found it.


View Replies !
Different Timestamps For Time Of Creation And Time Of Update
What is the syntax to be used in MySQL when you want one timestamp to be set when the record is created, and the other only when it is updated?

I tried something like that but got a syntax error.

View Replies !
Current Month
How do you get the current month - 1 month?

(so not a particular day, but the whole month)

View Replies !
Foreach? Add 10 To Current Value
I have a product table. If i want to increase the prices of the items by say $10. what's the syntax for that? How do I get the current value of the field in the current row.

Better explained:

UPDATE table SET price = price + 10?

View Replies !
Current Timestamp
I need to write a technical document for a testing procedure.
one of the steps is to have someone run a query wich will update a specific feild to the current timestamp. I know there is a function in MySQL that does this but im not sure how to use it in a query.
does anyone have a simple way to do this?

update host_users set last_updated = 'current timestamp here' where uname = 'username'

View Replies !
Upgrade From 3.23.49 To Current 5.0 Possible?
is it possible to do this without upgrading by step 3 to 4 4 to 5 ?? or would this totally mess up my current datatbase? which is a simple phpbb2 forum?

View Replies !
How To Get The Current Year
I'm a new bee to Mysql and i want to know how to get the Current year from the system date and then also know how to get the rows which are greater than the fetched year.

View Replies !
Current Users
How can I check what are the current users right now (except for the admin)?
I can't find this in a manual.

View Replies !
Keep Data Current From Another Db
I am using OSCommerce with mySQL as the backend, and I wanted to know what would be the best way to share data (specifically inventory levels) between my Progress db and my mySQL db with minimal or no user interaction?

View Replies !
How To Get Prev And Next Row To Current One?
I have a table called "items" which has following structure and content:

id | name
------------------------------------------
131 | Item Name 1
129 | Item Name 2
128 | Item Name 3
130 | Item Name 4

id field is not auto increment field. The only information I have is:
1. Results must be sorted by name
2. I can fetch current item only by its name e.g "Item Name 3"
3. Can't use offset in this case, as I only know current row by it's name

Is possible to get prev and next row with SQL query (sub-queries maybe?) when I know only 1 row?

View Replies !
Getting Current Date
I am using this to get the date and time to store in a mysql db:

PHP

$date = date("m.d.y"); $time = date("H:i:s");

The field types I am storing them in are date and time format.

Is this the best way to do it? Or are there time stamps that mysql can use automatically?

View Replies !
Retrieve Current Orders
For example if i want to retrieve current orders that have overdue subscribtion payment, I'll add an index to order_id and subscriber_id... Am I on the right track?
Or i should add an index to a field that is used in the WHERE clause.. FOR EXAMPLE (WHERE due_date < NOW()). Can I only add indexes to primary and foreign keys? If i add a foreign key to a field will it improve database performance?

View Replies !
Current Date Insert
Does MySQL support the CURRENT DATE reserved word?

i.e.

insert into mytable
( name
,MyDateColumn
)
values (
'FV'
,'CURRENT DATE')

I keep getting 0000-00-00 inserted using the above format, current date without single quotes gets an error. I <*thought*> that was standard SQL, but perhaps DB2 has polluted my mind.

View Replies !
Current Date Events
am havig the table event, in that am having event_start, event_end,event_name

can u tell which query display the only current date events

can u tell the query,

i have tried with UNIX_TIMESTAMP() AND NOW() , THESE ARE NOT HELPED MY EXPECTED OUTPUT

View Replies !
Current Time's MICROSECONDS
I am doing the following query, to get the microseconds of the current time, and I am always receiving '000000' as my result.

SELECT date_format(current_timestamp(), '%f') as test

View Replies !
Insert The Current Date
How can I insert the current date into my date field? Will it automatically increment each day? Because the auto increment option is greyed out in MySQL control centre when my data type is date.

View Replies !
Previous, Current, And Next In One Query?
This situation has come up a couple times and I've wanted to know if there's a better way to do it.

Given something unique (an ID number, a specific date/time, etc) I want to find the thing that comes before it and the one after it when sorted by something else. Oh, and the "something unique" isn't sequential - random intervals between each.

Code: ....

View Replies !
Current Selected Record
i need to do this and it also needs to be conditional.
Like, it needs to be the first row that sits before the currently selected row wich has a cat_id value of [comparision value].
I have read a bit about cursors, would this be a good way to do this?

View Replies !
Current MONTH And YEAR
Having an event-calendar table, and an attribute event_date, How can i retrieve the events of the current month and current year based on that field? .....

View Replies !
Returning Current Form
I have a table called `match` which holds details of games between teams.

`match` has:
`match_date`
`home_team`
`away_team`
`home_score`
`away_score`

I want a query to return the last 6 games (Win/Draw/Lose) for each team.
I am unsure if this can be done using my current table format.

View Replies !
Save Current User In DB
I want to create a field that will save the current user of the DB, I tried with

Field Name : Usuario
Field Type : char(30)
Default: CURRENT_USER

or

Default: USER

etc

but doesnt work

How can I define the field?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved