I have not seen a reply to this thread yet ... so ....

>I know this is an SQL question but does anyone know how to break dates
apart
>using the (cast or convert functions, (I think)) IN SQL,,

>its just that when I mask my date from my query I never get the right
date..

Can you elaborate some more on this?  What exact format are you trying 
to convert from and what exact format are you trying to go to?  Is that 
just display? What is the format in the database?

Not sure if this is anything you could use ... check out scalar functions 
at http://www.houseoffusion.com/scalar/scalar.htm like

SELECT * FROM FOO
WHERE EMPLOYEEID = '#FORM.EMPLOYEEID#'
AND {fn Year(STARTDATE)} = #DatePart("yyyy", Now())# 

and DatePart

<CFSET todayDate = Now()>
<BODY>
<H3>DatePart Example</H3>

<P>Today's date is <CFOUTPUT>#todayDate#</CFOUTPUT>.

<P>Using datepart, we can extract an integer representing
the various dateparts from that value
<CFOUTPUT>
<UL>
    <LI>year: #DatePart("yyyy", todayDate)#
    <LI>quarter: #DatePart("q", todayDate)#
    <LI>month: #DatePart("m", todayDate)#
    <LI>day of year: #DatePart("y", todayDate)#
    <LI>day: #DatePart("d", todayDate)#
    <LI>weekday: #DatePart("w", todayDate)#
    <LI>week: #DatePart("ww", todayDate)#
    <LI>hour: #DatePart("h", todayDate)#
    <LI>minute: #DatePart("n", todayDate)#
    <LI>second: #DatePart("s", todayDate)#
</UL>    
</CFOUTPUT>    


Joe Hoffman mailto:[EMAIL PROTECTED]
National Institutes of Health 
Center for Information Technology 
Division of Computer System Services

-----Original Message-----
From: John McCosker [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 13, 2001 7:31 AM
To: CF-Talk
Subject: sql date times


Hi all,

our sql server is set up to american date Time format, so as you know once
thats done you must play by its rules,

I know this is an SQL question but does anyone know how to break dates apart
using the (cast or convert functions, (I think)) IN SQL,,

its just that when I mask my date from my query I never get the right date..

I've submitted this query before, but not regarding the above...

if anyone has any ideas' I'd be well gratefull

thanx... JMC...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to