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 Time In Minutues To A Timestamp


How do you add / subtract time in minutes to a timestamp?

SELECT * FROM users WHERE chatOnline BETWEEN '2008-12-27 12:35:16' AND '2008-12-27 12:35+40:16'




View Complete Forum Thread with Replies

Related Forum Messages:
Timestamp :: Add 7 Days Time
How do i display a date as a new column 7 days after the initial timestamp eg.
current timestamp = 20050310000000

if i add 7 days to this won't it result in 20050317000000
eg SELECT *, DATE_FORMAT('%d/%m/%Y' , (dateAuthorised+7)) as expiryDate

I know this is the wrong approach as the timestamp 20050330000000 would cause an error

View Replies !
Timestamp - Making It Stamp The Time
This is wrong:
ALTER TABLE members CHANGE COLUMN startday DEFAULT NOW();
But it may convey what I want.
I created a table with a column called startday which I made a data type of timestamp which I had hoped would fill the field when a record is added. But no.

How do I alter the table column so that it will fill wiit the trimestamp of when the record is added?

View Replies !
TIMESTAMP :: Query By Time And Date
I have a field in my table that holds a timestamp. Below is a pseudo-query to describe what I would like to do.

SELECT * FROM `mytable` WHERE `saved_date` <= `6/24/05 10:22:34 AM`

`saved_date` is the field holding a TIMESTAMP. If anyone could give me the query that would actually do what I am trying to do above,

View Replies !
Time Difference Between TIMESTAMP Fields
Anyone know how to return the difference in time (in seconds) between two TIMESTAMP fields?

I am using MySQL ver 4.0.12 thus TIMEDIFF and all those other fancy functions dont work!

View Replies !
Timestamp :: Select Rows Inserted In 2 Weeks Time
I've got a TIMESTAMP(12) field in a table and I need to select all the rows that have been inserted or updated since 2 weeks (14 days) ago from the actual date each time the query is executed. How the heck can I do it?

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 I Can Change My Timestamp(14) To = Timestamp(8)
I am trying to find out how I can change my timestamp(14) to = timestamp(8).

View Replies !
Timestamp And Current_date/timestamp
Im stuck with a sql query.
Basically I have a db that stored a timestamp off everyone who has a successful login.
I want to be able to count all the people who have logged into today? How do I do that?

I thought the following would work but it didn't:

SELECT count(date) FROM nn_users_logs WHERE date = CURREN_TIMESTAMP

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 !
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 !
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 !
Minutes + TIME = TIME Function
I need some way to convert minutes (e.g. 80 mins) to SQL TIME (e.g. 01:20:00) in order to add it to another TIME var.

Is there any way to do this? I really dont want to convert my whole db. Basically, I want to do: e.g. 80 + 10:00:00 = 11:20:00.

View Replies !
How To Retrieve Mean Time Between Time Stamps
I have a table that stores failure information of external application. The time stamp of every failure event is stored. Now I'd like to make some system performance & reliability statistics calculations based on time stamps in certain recordset; mean time between failure MTBF, down time DT, etc.

Example:

2007-09-27 12:23:52
2007-09-27 08:50:23
2007-09-26 23:31:34
2007-09-26 21:45:33

Here the times between are (hours:mins): 3:33, 9:18, 1:46 and MTBF=4:52

Any effective possibility to make this example within a single query - or a procedure is needed?

View Replies !
Time Format Military Time
I know the time format it HH:MM:SS in mysql but can I input military time?
reason I can is that I want to later extract that information for calculations and military time is easier to work with.

View Replies !
Date-time Overlaps Another Time
had a time question in mysql...
i have a start and end time for a meeting table and i am comparing whether a new meeting conflicts with another meeting in same room on the same date.
i was wondering if i could check whether the 'date-time duration' in anyway overlaps another meetings date-time duration. visualized below...
............|____compareToThisMeeting__|
.....|_________meetingNewOverlaps__________|
i was doing something dumb before i realized i needed soemthing more complex (checking whether the start time of new meeting was 'BETWEEN' the start and end times of a meeting and whether the end time time is as well but i forgot the duration/middle value hehe).
(using asp)
and just returning booleans with a mySQL SELECT statement is what i am looking for like...
//within a loop in asp for meetings on same date/room
"SELECT '"+ year+"-"+month +"-"+day +" " + startHourString +":" + startMinuteString +":00''"+ " BETWEEN '"+ thisMeetingStart +"' AND '"+ thisMeetingEnd +"'"; (this doesnt cover the 'middle' overlap areas though)

View Replies !
Time And The Change Of Time For The Summer
I have a xampp server with mysql and php. A few days ago the time changed to the "summer time", one hour plus but the curtime() of mysql did not change.

Is there a way to change also this curtime() automatically?

View Replies !
Add Time :: 2 Hours To Given Time
how I can add a time of 2 hours to a given time (hh:mm:ss)?

View Replies !
Using NOW() And Timestamp In Sql
I need to limit the number of emails send within a half our period. Every
time an email is send, it is recorded in my log table (LOG) using NOW() as
entry. The field-type is a timestamp and the name of the field is NOW

How do I rephrase the SQL below to make it work

---
count(`LOG`.`ID`) FROM `LOG` WHERE NOW > x

---

where x = the current server time - half an hour

What should I put in place of x?

View Replies !
Another TIMESTAMP
How do I set one field to have the updated timestamp, and another to have
the created timestamp?

I want to do this directly from code generated from DB Designer if
possible?

View Replies !
Timestamp And Now()
I use a helpdesk php program that has a mysql timestamp called t_timestamp_opened.
For some reason the now() function is attached to this field.
So if I edit it in phpMyAdmin, or update other fields, that field is updated to the current time.
How do I remove the association with the now() fucntion for a field?
I cant see an option in phpMyAdmin, do I have to do it through sql?

View Replies !
Using Timestamp As A PK
i this table in my DB :
SimplePaperIntraDay :
Time TIMESTAMP
PaperID NVARCHAR
OPEN DOUBLE
HIGH DOUBLE
LOW DOUBLE
CLOSE DOUBLE
VOLUME DOUBLE

so far i've used a combined PK with paperid+time but i've read in several places that using a timestamp as a pk is not good and should be avoided because a round on the number can happen sometimes and thus crashing the on pkviolation .
is that correct ? if yes i can't see any other option other then adding a generated value ID column and using it as a PK but then it's a uselsss PK in making sure that i don't mistakengly enter double values for same time ...
how can this catch 22 be solved ?

View Replies !
Value Of Timestamp
I wonder if anybody knows for certain what the value of a field with data type timestamp will be?

a) The value will be the time when the update is performed?
b) The time when the transaction is committed?

The reason I ask is because it could make a significant difference.

imagine the following.

I am interested in reading all changes in a table made between time T0 and time T5. later I will to the same but between time T5 and time T10.

then imagine this:

T0
T4 - someone makes an update (transaction tx1 is started)
T5 - run query that checks for changes between T0 and T5
T6 - tx1 is committed
T10 - run query that checks for changes between T5 and T10

if value of timestamp is according to a) then I will never find out that a change was made. if it is according to b) I will see the change at time T10 when I run my query.

View Replies !
SQL Timestamp
This is the table I have:

No NameTimestamp Type
1 Jack Mon Nov 19 12:19:49 UTC+0800 2007 A
2 DaveTue Nov 20 8:38:13 UTC+0800 2007 A
3 Jack Mon Nov 12 12:19:49 UTC+0800 2007 A
4 Jack Sun Nov 18 12:19:49 UTC+0800 2007 A
5 Jack Sun Nov 18 12:19:49 UTC+0800 2007 B

Can I select the same Name with the same Type where the timestamp is less than 7 days from today's date? In this case, use 21st Nov as this is today's date. From the example I will get 1 - Jack and 4 - Jack. The format of the time in the table is really troublesome for me.

View Replies !
SQL Timestamp Help
I'm not sure how to perform "math" on a timestamp in an SQL query.

What I am trying to do is run a SELECT statement that will find all entries with a timestamp 20 minutes or older.

View Replies !
Timestamp Import
I need to import into mysql data from DB2. One of the DB2 table columns
is of the TIMESTAMP type, which, unlike its MySQL counterpart, supports
fractions of a second, up to 6 digits, i.e. it is of the form

2005-07-13-23:45:32.000000

....whereas the MySQL timestamp type is of the form

2005-07-13 23:45:32
Has anybody done this before? How can I keep the fractions of a second
when I do the import

View Replies !
Timestamp Conundrum
I was under the impression from the manual that if you added a field to a
table of type timestamp this would automatically be updated after each
insert/update of a new record, but all I get is 00000000.

Is there something else I should set?

View Replies !
Timestamp Default Value
I am using:
mysql Ver 12.22 Distrib 4.0.18, for sun-solaris2.9 (sparc)
And I do this:

mysql> create table test (a timestamp default null, b timestamp default null);
Query OK, 0 rows affected (0.03 sec)

mysql> desc test;
+-------+---------------+------+-----+----------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+----------------+-------+
| a | timestamp(14) | YES | | NULL | |
| b | timestamp(14) | YES | | 00000000000000 | |
+-------+---------------+------+-----+----------------+-------+
2 rows in set (0.00 sec)
Can anyone tell my why the default value for column 'b' is not NULL as well?

View Replies !
Inserting Timestamp
Is there a way to signal MySQL to insert a timestamp or date in for a field value?
Just as you can tell MySQL to increment:
UPDATE table SET value = value + 1 WHERE...

Is there a way to tell MySQL to insert a timestamp from the server for value?

View Replies !
Converting Timestamp
i am retrieving mysql datetime and timestamp fields into php and then dumping them out for display. The datetime fields come out in YYYY-MM-DD HH:MM:SS format, while the timestamps come back in YYYYMMDDHHMMSS format. Is there any way in sql to get the timestamps converted to YYYY-MM-DD HH:MM:SS format so that I don't have to do a bunch of string manipulations in php in order to get the format to be consistent?
(All of the docs seem to refer to ways to manipulate the format of datetimes and not timestamps. The datetime format is fine with me, it's the timestamp format that looks like geek-speak.)

View Replies !
Earliest Timestamp
I have a database that with records that look similar to this:

ID Name StockDate
1 Joe 20060428141845
2 Joe 20060428141849
3 Max 20060428141911
4 Joe 20060428141932
5 Bob 20060428141935
6 Bob 20060428141948

I'd like to write a query that groups records by Name but returns only the one with the earliest timestamp. Can someone tell me how I can do this? Can I do it with just a query, or will I need to use PHP or something to accomplish it?

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 !
TABLE Timestamp
Anyone know the query that would return the timestamp for a table's creation date?


View Replies !
Querying Timestamp
i got a timestamp timestamp(14) column.
format looks like 20050426043734
how do you query records created lets say within a week ago?

i tried

select * from table where timestamp < "one week ago";

but that doesnt seem to have worked.
i tried looking through mysql website but couldnt find an example @_@
i didnt want to do it via mathematical deductions...ie.. timestamp - 7
since im not sure how it'll handle month changes..i thought they would have like a built in statements like one week, one month..etc.

View Replies !
Timestamp Column
In a table I have a series of rows that, amongst other things, have a timestamp column. What I would like to do is select a specific row from the timestamp information (easy bit), but then I want to also collect the five previous entries by date/time.

View Replies !
Timestamp Today Only
"SELECT sig_name,timestamp FROM acid_event where sig_priority <=2 ORDER BY timestamp DESC LIMIT 10"

Timestamp is format like 2007-02-27 16:22:58. I'd like to if possible above select but where timestamp = today only.

View Replies !
Simple Timestamp
I am working on a new DB I have built, and one of the fields I made is the MySQL timestamp.I "thought" this field would autopopulate when a new record is created, and not change after that unless I forced it.But I notice that every time I edit the record that timestamp field gets reset to the current time.
Is that the correct way that field is supposed to function? And if so how do I use the timestamp in a field that will not change when the record gets edited?

View Replies !
Timestamp Format
I have just installed mysql on a linux server and now I am trying to create my tables. I use to mysql timestamp format being YYYY-MM-DD HH:MM:SS but it is showing up like this YYYYMMDDHHMMSS. Is there anything I can do. I read on mysql.com that it could be the version you are running or settings on the server.

View Replies !
Timestamp From Any Field
Is it possible to get a timestamp from a table that doesn't have any timestamp field?
In other words, I've got a table with three columns, none of which are a date, or timestamp type column. Only varchars (that don't contain any time/date type data). Is there a SQL statement that will return the time each record or row was entered into the table?

View Replies !
Timestamp Offset
I have a field in my database that is a timestamp. I am using phpmyadmin to manage the db.When I look at the structure of this field, I set the Browser Transformation to text/plain: date format, which makes the time stamp more readable.
How do I set the time offset to make it my local time? Would I put the offset in the transformation options box? If so what's the format?

View Replies !
Timestamp Update
In my table, there is a field which is a timestamp. Problemo here is whenever I update the other fields, this timestamp field always resets to now. So i lose the actual timestamp before the update.

View Replies !
Converting To Timestamp
i have a table with over 2000 records. it has separate month, date and year for birthdate. the year is in four digits. I wanted to convert the birth dates of the 2000 records to timestamp so that i can get their age . I tired to do it by updating the records but it is going to be one at a time by (concatening) and adding a column and then converting month, date and year of each record. i exported the columns to excel and tried it there but unsuccessful. Can anybody advice me if there is any other way or ... if there is a way to update all records by writing some function or any thing like that ?

View Replies !
Timestamp Does NOW() Return
I am inserting data into a mysql database via PHP. In my insert statement, I use NOW() to insert the current time into a field of type timestamp(14).
Now I am trying to convert this timestamp to a readable date. Is this a unix timestamp? a mysql timestamp? something else I've never heard of?
I tried some PHP functions I found on the web to convert a mysql timestamp to a unix timestamp. But when I plugged in the timestamp I'm getting from my data, it returns a date in the future.

So either:
a) the function is flawed
b) the clock on the database server is off
c) it's not a mysql timestamp

View Replies !
YYYYMMDDHHMMSS Timestamp
I keep having a problem with timestamps when I try to import from a text file. No matter how I format it, (YYYYMMDDHHMMSS, YYYY-MM-DD HH:MM:SS, etc.) I either get zeros if I set the table as datetime or timestamp, or if I set as text or number it turns into the wrong number:
20041122163500 -> 804760364
20041122191200 -> 804788064

I feel like I've tried everything. Here's the version info:

mysql Ver 14.6 Distrib 4.1.5-gamma, for portbld-freebsd5.3 (i386)

View Replies !
UNIX Timestamp
How do I get a UNIX timestamp in MySQL?

View Replies !
Timestamp Issue
I am programming in PHP, and I have a timestamp which is being added to the database like " 2004-11-11 16:30:20" and I need to add 3 hours to it, and format it to something more ledgable like November 11, 2004 - 4:30:20.

View Replies !
Sorting By Timestamp
I need to sort and echo out the 5 most recently either Added or Modified entries in my table, and am a bit confused as to how to do that. I know the statement goes something like:

SELECT * FROM table WHERE timestamp > .... LIMIT 5

Well, I think I know that it goes like that! *scratches head*

Also, I know this is not a PHP board, but would you know how I would store and echo those results out into different variables as well?

View Replies !
No Delimiters In Timestamp
I am using automatic timestamps in my tables, fe. for DateTimeCreated fields.
I would like MySQL to create these timestamps without delimiters. So fe. 2005-02-15 00:00:00 would be 20050215000000. Can anyone tell me how to achieve this, as I can't find a solution in the Manual, nor on the Web.

View Replies !
Min Max Does Not Work For Me For Timestamp
I have such a table:

id
timestamp
value
person

regardless or entering this
SELECT id, MIN(timestamp),value FROM table GROUP BY person

or this

SELECT id, MAX(timestamp),value FROM table GROUP BY person

The timestamp value may be properly pulled, yet, the value field is always the same. Meaning, not the value associated wuth the MIN or MAX timestamp value is shown, but the very first for that person. How is that possible?

View Replies !
Create Timestamp
I am trying to create a statement which will populate a timestamp cell. I need to take the current date, add a day then add a specific time. I have tried the following statment but have had no luck. Any suggestions?

update tags.triggers set next_time_of_day=str_to_date(adddate(current_date(),1) 11:12:12 %Y-%m-%d %H:%i:%s) where id=1;

View Replies !

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