Re: Date conversion
From: Steve Kass (skass_at_drew.edu)
Date: 08/21/04
- Next message: Pike: "Re: Aggregation with text"
- Previous message: Johnny Nielsen: "Re: Understanding the LIKE"
- In reply to: Maziar Aflatoun: "Date conversion"
- Next in thread: Robert Volesini: "RE: Date conversion"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 21 Aug 2004 11:05:43 -0500
Maziar,
One solution is
select dateadd(day, datediff(day, 0, StartDate),0)
If you need the result to be of type smalldatetime, use
select cast(dateadd(day, datediff(day, 0, StartDate),0) as smalldatetime)
Steve Kass
Drew University
"Maziar Aflatoun" <maz00@rogers.com> wrote in message
news:c5KVc.8897$UYx.1082@twister01.bloor.is.net.cable.rogers.com...
> Hi everyone,
>
> I have a database with a date field 'StartDate' as smalldatetime. I need
to
> grab the date part and not the time part.
>
> Ex. 2004-08-01 00:00:00 all I need is the 2004-08-01
>
> How do I do that using SQL (Convert or Cast?? )?
>
> Also, is there another datatype I can define it as in the the database so
> that it's only date not time and date like date in MySQL.
>
> Thank you
> Maz
>
>
>
>
>
- Next message: Pike: "Re: Aggregation with text"
- Previous message: Johnny Nielsen: "Re: Understanding the LIKE"
- In reply to: Maziar Aflatoun: "Date conversion"
- Next in thread: Robert Volesini: "RE: Date conversion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|