is possible to get UNIX timestamp with microseconds
when i try the following it just give 10 digits
mysqlSELECT unix_timestamp('20051114095641'+ INTERVAL 0 HOUR) as ts;
output :
1131933401 --- 10 digits
any tips?
tia!
--
MySQL General Mailing List
For list archives: http://lists.mysql.com
Hello.
According to the manual Unix timestamp (seconds since '1970-01-01
00:00:00', so, in my opinion UNIX_TIMESTAMP is not designed for
obtaining microseconds. Have a look here, if you haven't done this
yet:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
Ryan
i have this query:
SELECT COUNT(*) AS score FROM downloads WHERE date_add(dateline,
interval 1 hour) = now() GROUP BY filename ORDER BY score DESC
unfortunately for other reasons i had to change `dateline` to unix timestamp so this query is no longer able to run as intended. can anyone help
Sebastian [EMAIL PROTECTED] wrote on 08/15/2005 03:51:05 PM:
i have this query:
SELECT COUNT(*) AS score FROM downloads WHERE date_add(dateline,
interval 1 hour) = now() GROUP BY filename ORDER BY score DESC
unfortunately for other reasons i had to change `dateline` to unix
timestamp so
(dateline,
interval 1 hour) = now() GROUP BY filename ORDER BY score DESC
unfortunately for other reasons i had to change `dateline` to unix
timestamp so this query is no longer able to run as intended. can
anyone help with a work around?
btw, i am using php to run queries if that helps find
Sebastian [EMAIL PROTECTED] writes:
i have this query:
SELECT COUNT(*) AS score FROM downloads WHERE date_add(dateline,
interval 1 hour) = now() GROUP BY filename ORDER BY score DESC
unfortunately for other reasons i had to change `dateline` to unix
timestamp so this query is no longer
Scott Gifford wrote:
SELECT COUNT(*) AS score FROM downloads
WHERE dateline + 3600 = UNIX_TIMESTAMP()
GROUP BY filename ORDER BY score DESC
It would be better with
WHERE dateline = UNIX_TIMESTAMP() - 3600
so that it can use an index on dateline.
--
Keith Ivey [EMAIL
Keith Ivey [EMAIL PROTECTED] writes:
Scott Gifford wrote:
SELECT COUNT(*) AS score FROM downloads WHERE dateline +
3600 = UNIX_TIMESTAMP() GROUP BY filename ORDER BY score DESC
It would be better with
WHERE dateline = UNIX_TIMESTAMP() - 3600
so that it can use an index
Sebastian wrote:
i have this query:
SELECT COUNT(*) AS score FROM downloads WHERE date_add(dateline,
interval 1 hour) = now() GROUP BY filename ORDER BY score DESC
unfortunately for other reasons i had to change `dateline` to unix
timestamp so this query is no longer able to run
Hello,
I have been pulling my hair out trying to get a SELECT statement to work
using a range of Unix timestamps as the criteria.
MySQL Version 4.0
SELECT FROM_UNIXTIME(time) FROM srvlog WHERE FROM_UNIXTIME(time =
'1080948600') AND FROM_UNIXTIME(time = '1080997876');
I also tried
Craig Hibbert wrote:
SELECT FROM_UNIXTIME(time) FROM srvlog WHERE FROM_UNIXTIME(time =
'1080948600') AND FROM_UNIXTIME(time = '1080997876');
Why do you have FROM_UNIXTIME() in the WHERE clause? You said
the time column was already in Unix time, and regardless, you're
passing the function the
From: Paul DuBois
At 17:50 -0500 5/16/04, Paul DuBois wrote:
Not a huge difference, I guess. But I suppose if a query that
uses one or the other of these expressions processes a large number
of rows, it might pay to run some comparative testing.
Another interesting point is whether one
Hello,
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me an empty array. What am I doing wrong?
TNX
--
MySQL General Mailing List
For list archives:
16, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Select distinct year from unix timestamp
Hello,
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me
this function
FROM_UNIXTIME(unix_timestamp,format).
Year does not operate on a unix timestamp.
John
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
?
TNX
I think you need this function
FROM_UNIXTIME(unix_timestamp,format).
Year does not operate on a unix timestamp.
Sure it does:
mysql select t, year(t) from tsdemo1;
++-+
| t | year(t) |
++-+
| 20010822133241 |2001
this function
FROM_UNIXTIME(unix_timestamp,format).
Year does not operate on a unix timestamp.
Working like a charm. My query now is:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M') FROM table_name ORDER BY
created DESC
How can I add more fields to query. If I write:
SELECT DISTINCT FROM_UNIXTIME
am I doing wrong?
TNX
I think you need this function
FROM_UNIXTIME(unix_timestamp,format).
Year does not operate on a unix timestamp.
Sure it does:
mysql select t, year(t) from tsdemo1;
++-+
| t | year(t) |
++-+
| 20010822133241
From: T. H. Grejc
How can I add more fields to query. If I write:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M'), other_field FROM
table_name ORDER BY created DESC
I loose distinction (all dates are displayed).
TNX
I don't think distinction is lost. All the rows should still be distinct
From: Paul DuBois At 22:27 +0200 5/16/04,
John Fawcett wrote:
Year does not operate on a unix timestamp.
Sure it does:
mysql select t, year(t) from tsdemo1;
++-+
| t | year(t) |
++-+
| 20010822133241 |2001
John Fawcett wrote:
From: T. H. Grejc
How can I add more fields to query. If I write:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M'), other_field FROM
table_name ORDER BY created DESC
I loose distinction (all dates are displayed).
TNX
I don't think distinction is lost. All the rows should still
At 0:25 +0200 5/17/04, John Fawcett wrote:
From: Paul DuBois At 22:27 +0200 5/16/04,
John Fawcett wrote:
Year does not operate on a unix timestamp.
Sure it does:
mysql select t, year(t) from tsdemo1;
++-+
| t | year(t
From: Paul DuBois
You're right. You'd have to apply YEAR() to
FROM_UNIXTIME(UNIX_TIMESTAMP(arg)).
and you can avoid YEAR() altogether by using a
format string. in FROM_UNIXTIME()
John
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
monthandyear must be replaced by your function
which extracts month and year from the unix timestamp column
(in both the select and group by).
I think that's what you needed.
John
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com
At 0:38 +0200 5/17/04, John Fawcett wrote:
From: Paul DuBois
You're right. You'd have to apply YEAR() to
FROM_UNIXTIME(UNIX_TIMESTAMP(arg)).
and you can avoid YEAR() altogether by using a
format string. in FROM_UNIXTIME()
Right again. :-)
--
Paul DuBois, MySQL Documentation Team
Madison,
At 17:50 -0500 5/16/04, Paul DuBois wrote:
At 0:38 +0200 5/17/04, John Fawcett wrote:
From: Paul DuBois
You're right. You'd have to apply YEAR() to
FROM_UNIXTIME(UNIX_TIMESTAMP(arg)).
and you can avoid YEAR() altogether by using a
format string. in FROM_UNIXTIME()
Right again. :-)
I was curious
There seems to be a flaw in the myODBC driver
02.50 when working with the Unix-Timestamp()
function.
Apparently, the driver doesn't know which
data-type to use...
When I send the sql statement:
--
Select
( UNIX_TIMESTAMP(U.lastTime
that does the trick.
My guess is that the ODBC driver is
behaving badly in this case ...
Cheers,
bart
Van: Bart Goormans
Verzonden: zondag 16 december 2001 9:21
There seems to be a flaw in the myODBC driver
02.50 when working with the Unix-Timestamp()
function.
Apparently, the driver
Andreas Iwanowski wrote:
How can i fix the problem that the records are ordered by unixtime,
beginning with the newest record ?
http://www.mysql.com/doc/S/E/SELECT.html
--
H | Hi, I'm currently out of my mind. Please leave a message. BP!
29 matches
Mail list logo