|
A Handy SQL Timestamp Function
Published: July 9, 2008
Hey, Ted:
I have found a great tool for working with timestamp data. I have used it for performance tracking and analyzing data intervals. It's SQL's Timestampdiff function, and I think you should tell readers of Four Hundred Guru about it.
Timestampdiff returns the difference between two timestamps in the interval of your choice. The first parameter for the timestampdiff function is the interval to use. Valid values for this parameter are:
|
1
|
Fractions of a second
|
|
2
|
Seconds
|
|
4
|
Minutes
|
|
8
|
Hours
|
|
16
|
Days
|
|
32
|
Weeks
|
|
64
|
Months
|
|
128
|
Quarters
|
|
256
|
Years
|
|