UNIX timestamp with microseconds

2005-11-16 Thread Ryan Escarez
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

Re: UNIX timestamp with microseconds

2005-11-16 Thread Gleb Paharenko
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

unix timestamp

2005-08-15 Thread Sebastian
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

Re: unix timestamp

2005-08-15 Thread SGreen
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

Re: unix timestamp

2005-08-15 Thread Chris
(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

Re: unix timestamp

2005-08-15 Thread Scott Gifford
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

Re: unix timestamp

2005-08-15 Thread Keith Ivey
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

Re: unix timestamp

2005-08-15 Thread Scott Gifford
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

Re: unix timestamp

2005-08-15 Thread Bastian Balthazar Bux
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

Select statement inbetween unix timestamp ranges

2004-07-26 Thread Craig Hibbert
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

Re: Select statement inbetween unix timestamp ranges

2004-07-26 Thread Keith Ivey
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

Re: [SPAM]Re: e: Select distinct year from unix timestamp

2004-05-17 Thread John Fawcett
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

Select distinct year from unix timestamp

2004-05-16 Thread T. H. Grejc
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:

RE: Select distinct year from unix timestamp

2004-05-16 Thread Dathan Vance Pattishall
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

Re: Select distinct year from unix timestamp

2004-05-16 Thread John Fawcett
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]

Re: Select distinct year from unix timestamp

2004-05-16 Thread Paul DuBois
? 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

Re: Select distinct year from unix timestamp

2004-05-16 Thread T. H. Grejc
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

Re: Select distinct year from unix timestamp

2004-05-16 Thread T. H. Grejc
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

Re: Select distinct year from unix timestamp

2004-05-16 Thread John Fawcett
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

Re: [SPAM]Re: Select distinct year from unix timestamp

2004-05-16 Thread John Fawcett
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

Re: Select distinct year from unix timestamp

2004-05-16 Thread T. H. Grejc
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

Re: [SPAM]Re: Select distinct year from unix timestamp

2004-05-16 Thread Paul DuBois
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

Re: e: Select distinct year from unix timestamp

2004-05-16 Thread John Fawcett
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:

Re: Select distinct year from unix timestamp

2004-05-16 Thread John Fawcett
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

Re: e: Select distinct year from unix timestamp

2004-05-16 Thread Paul DuBois
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,

Re: e: Select distinct year from unix timestamp

2004-05-16 Thread Paul DuBois
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

Unix-Timestamp() in myODBC 02.50

2001-12-16 Thread Bart Goormans
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

RE: Unix-Timestamp() in myODBC 02.50

2001-12-16 Thread Bart Goormans
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

Re: [PHP-DB] Order by unix timestamp

2001-07-12 Thread Ashley M. Kirchner
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!