RE: tellme Timestamp

2003-08-26 Thread Jennifer Goodie
> When I run a query that has a timestamp field, How can I query on just the
> date.  Time stamp puts in the min, hour, and sec.  All I need is the year,
> month, and day.
>
> SELECT * FROM table_name WHERE date = '2003-08-25';

select * FROM table_name WHERE DATE_FORMAT(date,'%Y-%m-%d') = '2003-08-25
or
select * FROM table_name WHERE LEFT(date,8) = '20030825'
or
select * FROM table_name WHERE date LIKE '20030825%'
or
select * FROM table_name WHERE TO_DAYS(date) = TO_DAYS('2003-08-25')
or
select * FROM table_name WHERE DAYOFMONTH(date) = '25' AND MONTH(date) =
'08' AND YEAR(date) = '2003'
or
select * from table_name WHERE date between '2003082500' AND
'20030825235959'  (check the range on this, I don't use it so it might be
wrong '2003082600' might be better)

Some are quicker than others, I'm just demonstrating that there's a lot of
different ways to do it, mysql has a lot of built in functions to deal with
date/time values.  I'm sure I missed a few ways.  All the date and time
functions can be found in the manual
http://www.mysql.com/doc/en/Date_and_time_functions.html



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



Re: tellme Timestamp

2003-08-25 Thread Dan J. Rychlik
I apologize for this,

But how exactly do I that?

When I run a query that has a timestamp field, How can I query on just the
date.  Time stamp puts in the min, hour, and sec.  All I need is the year,
month, and day.

SELECT * FROM table_name WHERE date = '2003-08-25';


- Original Message -
From: "Antony Dovgal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 9:19 AM
Subject: Re: tellme Timestamp


> On Fri, 22 Aug 2003 17:14:38 -0500
> "Dan J. Rychlik" <[EMAIL PROTECTED]> wrote:
>
> > Hello All,
> >
> > I am trying to find out how I can change my timestamp(14) to
timestamp(8).
> use DATE fields instead.
> or use DATE_FORMAT() with TIMESTAMP to get only date.
>
> ---
> WBR,
> Antony Dovgal aka tony2001
> [EMAIL PROTECTED]
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>


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



Re: tellme Timestamp

2003-08-23 Thread Antony Dovgal
On Fri, 22 Aug 2003 17:14:38 -0500
"Dan J. Rychlik" <[EMAIL PROTECTED]> wrote:

> Hello All,
> 
> I am trying to find out how I can change my timestamp(14) to timestamp(8).  
use DATE fields instead.
or use DATE_FORMAT() with TIMESTAMP to get only date.

---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED]

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