Mario,
Here is a better solution but not very flexible though.. i think this is what
you are looking for...

select 'CurrentDate'=Left(GetDate(),11),'CurrentTime'=right(GetDate(),8)

DatePart doesnt allow to get "AM/PM" or i dont know of way to extract it..

Joe



On Mon, 18 Nov 2002 19:41:42 -0000 "Ciliotta, Mario" <[EMAIL PROTECTED]>
wrote:

> Joe,
> 
> I tried the query and it worked but I have two
> quick questions:
> 
> 1) is there anyway to get the time to show as
> 15:00 instead of 15:0
> 2) is there a way to get the AM/PM to Show
> 
> Sorry for the questions, but I have tried and
> failed to get it.
> 
> Here is my code:
> 
> SELECT Cast(LEFT(DateName(mm,
> Event_Start_Date), 3) 
>     AS varchar(3)) + ' ' + Cast(DatePart(dd,
> Event_Start_Date) 
>     AS varchar(2)) AS currDate,
> Cast(DatePart(hh, 
>     Event_Start_Date) AS varchar(2)) + ':' +
> Cast(DatePart(mi, 
>     Event_Start_Date) AS varchar(2)) AS
> currTime
> FROM dbo.tbl_Diversity_Events
> 
> 
> Thanks again,
> 
> Mario
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 18, 2002 12:41 PM
> To: CF-Talk
> Subject: Re: Date time Question (CF and SQL)
> 
> 
> Mario..
> Here is one way of doing this.... You
> substitute GetDate() with your dates.
> 
> select Cast(left(DateName(mm,GetDate()),3) as
> varchar(3))+' '+ 
>        Cast(DatePart(dd,GetDate()) as
> varchar(2))+' '+ 
>        Cast(DatePart(yyyy,GetDate()) as
> varchar(4)) as currDate,
>        Cast(DatePart(hh,GetDate()) as
> varchar(2))+':'+ 
>        Cast(DatePart(mi,GetDate()) as
> varchar(2))+':'+ 
>        Cast(DatePart(ss,GetDate()) as
> varchar(2)) as currTime
> 
> Joe
> 
> 
> On Mon, 18 Nov 2002 12:05:12 -0500 "Ciliotta,
> Mario" 
> wrote:
> 
> > Hi All,
> > 
> > I have a questions, I am using Sql Server 7.0
> > and I have field called Event_Start_DateTime
> > and I would like my query to be able to
> return
> > to me two fields
> > the date and the time
> > 
> > ie 
> > 
> > The field contains:  12/12/2002 7:30:00AM
> > 
> > and I would like my query to return:
> > 
> > Dec 12  (Start Date)
> > 7:30 PM (Start Time)
> > 
> > I know how to do it in CF, but I have many
> > records returned and I would prefer to have
> my
> > database do some of the work, instead of my
> > cuff server doing all the work.
> > 
> > I believe that there are CAST and CONVERT
> > functions but I cannot get it to work.
> > 
> > Thanks
> > 
> > Mario
> > 
> > This message is for the named person's use
> > only. It may contain sensitive and private
> > proprietary or legally privileged
> information.
> > No confidentiality or privilege is waived or
> > lost by any mistransmission. If you are not
> the
> > intended recipient, please immediately delete
> > it and all copies of it from your system,
> > destroy any hard copies of it and notify the
> > sender. You must not, directly or indirectly,
> > use, disclose, distribute, print, or copy any
> > part of this message if you are not the
> > intended recipient. CREDIT SUISSE GROUP and
> > each legal entity in the CREDIT SUISSE FIRST
> > BOSTON or CREDIT SUISSE ASSET MANAGEMENT
> > business units of CREDIT SUISSE FIRST BOSTON
> > reserve the right to monitor all e-mail
> > communications through its networks. Any
> views
> > expressed in this message are those of the
> > individual sender, except where the message
> > states otherwise and the sender is authorized
> > to state them to be the views of any such
> > entity.
> > Unless otherwise stated, any pricing
> > information given in this message is
> indicative
> >  only, is subject to change and does not
> > constitute an offer to deal at any price
> > quoted. Any reference to the terms of
> executed
> > transactions should be treated as 
> preliminary
> > only and subject to our formal written
> > confirmation.
> > 
> > 
> > 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to