This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System TimeStamp

 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I get the System timestamp in MYSQL?

I have done like below.

SELECT now();

But it does't give exactly my System datetime.


thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anvi,
Now is correct. What do you mean that it doesn't give you exactly the current timestamp? How much is it off by?
 
ahamed irshad
Ranch Hand
Posts: 31
C++ Notepad Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use this query

select sysdate from dual
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahamed irshad wrote:you can use this query

select sysdate from dual
Does that work for MySQL?
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi anvi,

Do you use "now()" function in a trigger or procedure? "Now" does return the exact time that triggering event started, unlike "sysdate()". If you need to get the exact time when the now/sysdate line is executed you should use "sysdate()".

You may take a look at the manual.

Regards,

Fatih.
 
ahamed irshad
Ranch Hand
Posts: 31
C++ Notepad Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i mean sysdate() only

 
ahamed irshad
Ranch Hand
Posts: 31
C++ Notepad Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this link


http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_now
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic