Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 24th, 2003, 06:58 PM
Xmevs Xmevs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mosjøen, Nordland, Norway
Posts: 27 Xmevs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Timestamp trouble

I have a table with two timestamp fields. Whenever I update one of them, the other one gets the exact same value... Is this right?

Reply With Quote
  #2  
Old November 24th, 2003, 07:11 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Timestamp trouble

Here is what the MySQL manualsays about timestamps...
Quote:

TIMESTAMP[(M)]

A timestamp. The range is '1970-01-01 00:00:00' to sometime in the year 2037. MySQL displays TIMESTAMP values in YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDD format, depending on whether M is 14 (or missing), 12, 8, or 6, but allows you to assign values to TIMESTAMP columns using either strings or numbers. A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation because it is automatically set to the date and time of the most recent operation if you don't give it a value yourself. You can also set it to the current date and time by assigning it a NULL value.

MySQL Reference Manual (C) 2002 MySQL AB



if you are inserting the current time into one of the timestamp fields and not specifying NULL for the other, then MySQL will automatically populate the other timestamp field with the current time, hence the fact that both are the same...

Reply With Quote
  #3  
Old November 24th, 2003, 07:13 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Timestamp trouble

looks like I read that wrong... if you do not specify a time OR use a null, it will insert the current time automatically... sorry about that...

Reply With Quote
  #4  
Old November 24th, 2003, 07:13 PM
Xmevs Xmevs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mosjøen, Nordland, Norway
Posts: 27 Xmevs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Timestamp trouble

xxxxxxx MySQL. That's unnecessary... So int(14) it is...

Reply With Quote
  #5  
Old November 24th, 2003, 08:42 PM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Send a message via Yahoo to postalcow
RE: Timestamp trouble

Xmevs,

I edited your post. You can at least attempt to be polite

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Timestamp trouble


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT