> -----Original Message-----
> From: Alan Rother [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 15, 2006 3:50 PM
> To: CF-Talk
> Subject: Re: SQL DateTime conversion
> 
> Pretty much what I cam up with
> 
> SELECT CAST(MONTH(getDate()) AS VARCHAR(5))
> + '/' + CAST(DAY(getDate()) AS VARCHAR(5)) + '/' + 
> CAST(YEAR(getDate()) AS
> VARCHAR(5))
> 
> 
> On 6/15/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
> >
> > You can try doing
> >
> > SELECT
> >        CAST(
> >                (
> >                STR(MONTH( date_field )) + '/' +
> >                STR(DAY( date_field )) + '/' +
> >                STR(YEAR( date_field ))
> >                )
> >                AS DATETIME
> >        ) AS the_date
> > FROM
> >        [table]
> >
> >
> > There's probbably a better way though.
> >
> > .......................
> > Ben Nadel
> > www.bennadel.com
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, June 15, 2006 3:17 PM
> > To: CF-Talk
> > Subject: SQL DateTime conversion
> >
> > I need to convert a Date Time (9/15/2006  11:05:38 AM)   to a date
> > (9/15/2006 )  within an SQL statement. The source of the 
> data is from
> > within
> > the SQL statement and I don't want to do any looping so 
> your standard CF
> > functions don't apply. Is this possible?


If he's using SQL Server it can be shortened to:

CONVERT(varchar(10),DateField,101) AS MyFormattedDate

Check out the Books Online docs under CONVERT for more format conversions
with dates.

Andy



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243676
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to