Re: TimeStamp issue

2006-03-02 Thread gerald_clark

rtroiana wrote:


Hi All,



I have recently noticed in the MySQL 5.0 documentation in section 11.3.1.
The DATETIME, DATE, and TIMESTAMP Types, it's mentioned that 




TIMESTAMP values cannot be earlier than 1970 or later than 2037. This means
that a date such as '1968-01-01', while legal as a DATETIME or DATE value,
is not valid as a TIMESTAMP value and is converted to 0.



Is that a correct range for TimeStamp? It's not big enough to be used in a
real life application.
 


Why not?
It is not 2037 yet.
Timestamp is designed to record when records are updated, not for 
storing arbitrary dates and times.





I plan to use DATETIME instead of TIMESTAMP. I used to use
CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP as default value for my
TimeStamp column. Is there a way to assign default value to a DateTime
column, since I couldn't find that in the documentation?



Thanks,

Reema




 




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: TimeStamp issue

2006-03-02 Thread Rhino
If you need a broader range of dates, you could use DATETIME instead of 
TIMESTAMP: DATETIME can handle the range '1000-01-01 00:00:00' through 
'-12-31 23:59:59'. The only big difference is that DATETIME does not 
store the fractional part of the seconds, e.g. 
milliseconds/microseconds/nanonseconds. If you have to keep the fractional 
part of the seconds, you could store them in a second column defined as some 
kind of integer.


--
Rhino

- Original Message - 
From: rtroiana [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Thursday, March 02, 2006 10:10 AM
Subject: TimeStamp issue



Hi All,



I have recently noticed in the MySQL 5.0 documentation in section 11.3.1.
The DATETIME, DATE, and TIMESTAMP Types, it's mentioned that



TIMESTAMP values cannot be earlier than 1970 or later than 2037. This 
means

that a date such as '1968-01-01', while legal as a DATETIME or DATE value,
is not valid as a TIMESTAMP value and is converted to 0.



Is that a correct range for TimeStamp? It's not big enough to be used in a
real life application.



I plan to use DATETIME instead of TIMESTAMP. I used to use
CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP as default value for my
TimeStamp column. Is there a way to assign default value to a DateTime
column, since I couldn't find that in the documentation?



Thanks,

Reema










No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: TimeStamp issue

2006-03-02 Thread SGreen
In fact, no time values in MySQL are fractional (yet). All times are 
stored to the nearest second regardless of which date-time-like storage 
type you use. They way Rhino phrased his answer, it sounded as though 
TIMSTAMP would save fractional seconds. It doesn't. He is spot on about 
needing a separate column to store any values that represent fractions of 
seconds.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Rhino [EMAIL PROTECTED] wrote on 03/02/2006 01:25:36 PM:

 If you need a broader range of dates, you could use DATETIME instead of 
 TIMESTAMP: DATETIME can handle the range '1000-01-01 00:00:00' through 
 '-12-31 23:59:59'. The only big difference is that DATETIME does not 

 store the fractional part of the seconds, e.g. 
 milliseconds/microseconds/nanonseconds. If you have to keep the 
fractional 
 part of the seconds, you could store them in a second column defined as 
some 
 kind of integer.
 
 --
 Rhino
 
 - Original Message - 
 From: rtroiana [EMAIL PROTECTED]
 To: mysql@lists.mysql.com
 Sent: Thursday, March 02, 2006 10:10 AM
 Subject: TimeStamp issue
 
 
  Hi All,
 
 
 
  I have recently noticed in the MySQL 5.0 documentation in section 
11.3.1.
  The DATETIME, DATE, and TIMESTAMP Types, it's mentioned that
 
 
 
  TIMESTAMP values cannot be earlier than 1970 or later than 2037. This 

  means
  that a date such as '1968-01-01', while legal as a DATETIME or DATE 
value,
  is not valid as a TIMESTAMP value and is converted to 0.
 
 
 
  Is that a correct range for TimeStamp? It's not big enough to be used 
in a
  real life application.
 
 
 
  I plan to use DATETIME instead of TIMESTAMP. I used to use
  CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP as default value for 
my
  TimeStamp column. Is there a way to assign default value to a DateTime
  column, since I couldn't find that in the documentation?
 
 
 
  Thanks,
 
  Reema
 
 
 
 
 
 
 

 
 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 
01/03/2006
 
 
 
 -- 
 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 
01/03/2006
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 


Re: TimeStamp issue

2006-03-02 Thread Rhino



Thanks for keeping me honest! I'd 
forgotten that MySQL timestamps don't keep the fractional parts of seconds 
either; I mostly use DB2 which keeps the fractional parts (microseconds) and 
forgot about this quirk of MySQL.

--
Rhino

  - Original Message - 
  From: 
  [EMAIL PROTECTED] 
  To: Rhino 
  Cc: mysql@lists.mysql.com ; rtroiana 
  
  Sent: Thursday, March 02, 2006 1:42 
  PM
  Subject: Re: TimeStamp issue
  In fact, no time values in 
  MySQL are fractional (yet). All times are stored to the nearest second 
  regardless of which date-time-like storage type you use. They way Rhino 
  phrased his answer, it sounded as though TIMSTAMP would save fractional 
  seconds. It doesn't. He is spot on about needing a separate column to store 
  any values that represent fractions of seconds. Shawn GreenDatabase AdministratorUnimin 
  Corporation - Spruce Pine "Rhino" [EMAIL PROTECTED] wrote on 
  03/02/2006 01:25:36 PM: If you need a broader range of dates, you 
  could use DATETIME instead of  TIMESTAMP: DATETIME can handle the 
  range '1000-01-01 00:00:00' through  '-12-31 23:59:59'. The only 
  big difference is that DATETIME does not  store the fractional part of 
  the seconds, e.g.  milliseconds/microseconds/nanonseconds. If you have 
  to keep the fractional  part of the seconds, you could store them in a 
  second column defined as some  kind of integer.  
  -- Rhino  - Original Message -  From: 
  "rtroiana" [EMAIL PROTECTED] To: 
  mysql@lists.mysql.com Sent: Thursday, March 02, 2006 10:10 
  AM Subject: TimeStamp issueHi 
  All, I have recently 
  noticed in the MySQL 5.0 documentation in section 11.3.1.  The 
  DATETIME, DATE, and TIMESTAMP Types, it's mentioned that  
 "TIMESTAMP values cannot be earlier than 1970 
  or later than 2037. This   means  that a date such as 
  '1968-01-01', while legal as a DATETIME or DATE value,  is not 
  valid as a TIMESTAMP value and is converted to 0."  
 Is that a correct range for TimeStamp? It's not 
  big enough to be used in a  real life application. 
  I plan to use DATETIME instead of 
  TIMESTAMP. I used to use  "CURRENT_TIMESTAMP on update 
  CURRENT_TIMESTAMP" as default value for my  TimeStamp column. Is 
  there a way to assign default value to a DateTime  column, since I 
  couldn't find that in the documentation?   
Thanks,   Reema  
   
   
No virus found in this incoming message. Checked by 
  AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.1/272 - 
  Release Date: 01/03/2006--  No 
  virus found in this outgoing message. Checked by AVG Free 
  Edition. Version: 7.1.375 / Virus Database: 268.1.1/272 - Release 
  Date: 01/03/2006   --  MySQL General Mailing 
  List For list archives: http://lists.mysql.com/mysql To 
  unsubscribe:  
  http://lists.mysql.com/[EMAIL PROTECTED] 
  
  
  

  No virus found in this incoming message.Checked by AVG Free 
  Edition.Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 
  01/03/2006
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: TimeStamp issue

2006-03-02 Thread rtroiana
Thanks to all of you for replying. I'm using DATETIME instead of TIMESTAMP
now. Although I still haven't find the answer for my second question.

 

  I used to use
  CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP as default value for my
  TimeStamp column. Is there a way to assign default value to a DateTime
  column, since I couldn't find that in the documentation?



 

 

 

  _  

From: Rhino [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 02, 2006 3:50 PM
To: [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com; rtroiana
Subject: Re: TimeStamp issue

 

Thanks for keeping me honest! I'd forgotten that MySQL timestamps don't keep
the fractional parts of seconds either; I mostly use DB2 which keeps the
fractional parts (microseconds) and forgot about this quirk of MySQL.

 

--

Rhino

- Original Message - 

From: [EMAIL PROTECTED] 

To: Rhino mailto:[EMAIL PROTECTED]  

Cc: mysql@lists.mysql.com ; rtroiana mailto:[EMAIL PROTECTED]  

Sent: Thursday, March 02, 2006 1:42 PM

Subject: Re: TimeStamp issue

 


In fact, no time values in MySQL are fractional (yet). All times are stored
to the nearest second regardless of which date-time-like storage type you
use. They way Rhino phrased his answer, it sounded as though TIMSTAMP would
save fractional seconds. It doesn't. He is spot on about needing a separate
column to store any values that represent fractions of seconds. 

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine 

Rhino [EMAIL PROTECTED] wrote on 03/02/2006 01:25:36 PM:

 If you need a broader range of dates, you could use DATETIME instead of 
 TIMESTAMP: DATETIME can handle the range '1000-01-01 00:00:00' through 
 '-12-31 23:59:59'. The only big difference is that DATETIME does not 
 store the fractional part of the seconds, e.g. 
 milliseconds/microseconds/nanonseconds. If you have to keep the fractional

 part of the seconds, you could store them in a second column defined as
some 
 kind of integer.
 
 --
 Rhino
 
 - Original Message - 
 From: rtroiana [EMAIL PROTECTED]
 To: mysql@lists.mysql.com
 Sent: Thursday, March 02, 2006 10:10 AM
 Subject: TimeStamp issue
 
 
  Hi All,
 
 
 
  I have recently noticed in the MySQL 5.0 documentation in section
11.3.1.
  The DATETIME, DATE, and TIMESTAMP Types, it's mentioned that
 
 
 
  TIMESTAMP values cannot be earlier than 1970 or later than 2037. This 
  means
  that a date such as '1968-01-01', while legal as a DATETIME or DATE
value,
  is not valid as a TIMESTAMP value and is converted to 0.
 
 
 
  Is that a correct range for TimeStamp? It's not big enough to be used in
a
  real life application.
 
 
 
  I plan to use DATETIME instead of TIMESTAMP. I used to use
  CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP as default value for my
  TimeStamp column. Is there a way to assign default value to a DateTime
  column, since I couldn't find that in the documentation?
 
 
 
  Thanks,
 
  Reema
 
 
 
 
 
 



 
 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006
 
 
 
 -- 
 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 


  _  


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006



Re: TimeStamp issue

2006-03-02 Thread sheeri kritzer
On 3/2/06, rtroiana [EMAIL PROTECTED] wrote:
 Thanks to all of you for replying. I'm using DATETIME instead of TIMESTAMP
 now. Although I still haven't find the answer for my second question.



   I used to use
   CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP as default value for my
   TimeStamp column. Is there a way to assign default value to a DateTime
   column, since I couldn't find that in the documentation?


Sure.  You could run a trigger on an insert statement to update the
DATETIME field to the contents of SELECT NOW();

-Sheeri

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Timestamp issue

2002-09-17 Thread Mikhail Entaltsev

Prafulla,

please check documentation http://www.mysql.com/doc/en/DATETIME.html
...
The TIMESTAMP column type provides a type that you can use to automatically
mark INSERT or UPDATE operations with the current date and time. If you have
multiple TIMESTAMP columns, only the first one is updated automatically.
...
You need to change type of fields from timestamp to datetime.

Best regards,
Mikhail.


- Original Message -
From: Prafulla Girgaonkar [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, September 17, 2002 1:19 PM
Subject: Timestamp issue



Mysql Version::

Server version  3.23.47-nt
Protocol version10
Connection  . via named pipe
UNIX socket MySQL

OS::
Windows NT 4.0 Workstation


Hello
Following is the description of the problem being faced.

Problem:
The first timestamp column in a table is set to current date-time value as
soon as we update one or more columns in the table.

Example:

The guest information is stored in a table named GUEST. The schema for it is
as below.

create table guest (guestID int, arrivalDate timestamp, departureDate
timestamp, status char(1));

Above table is populated using following queries.

insert into guest values (1, '2002-09-30',  '2002-10-14', 'Y');
insert into guest values (2, '2002-09-20',  '2002-10-01', 'Y');
insert into guest values (3, '2002-09-15',  '2002-09-25', 'Y');
insert into guest values (4, '2002-09-12',  '2002-09-20', 'Y');


If we use following query to update the status from Y to N, then arrivalDate
column is set to CURRENT(system) date-time value.

update guest set status = 'N';

Does anybody have any information on this issue?

Thanx in advance.

Prafulla

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




re: Timestamp issue in mysql

2002-09-17 Thread Victoria Reznichenko

Prafulla,
Tuesday, September 17, 2002, 2:12:58 PM, you wrote:

PG Following is the description of the problem being faced.

PG Problem:
PG The first timestamp column in a table is set to current date-time value as soon as 
we update one or more columns in the table.

It's a normal behaviour of TIMESTAMP column:
 http://www.mysql.com/doc/en/DATETIME.html


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php