QofQ Date Comparison Problem...

2008-03-11 Thread Che Vilnonis
How can I compare dates in a QofQ date comparison? See code snippet below.
Thanks, Che

cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()), m/d/)
cfset dirArt  = ExpandPath(../)  emailblast

cfdirectory
action=LIST 
directory=#dirArt# 
name=getArt
filter=*.jpg

cfquery name=filteredArt dbtype=query
select  name from getArt
where   type = 'file' and
datelastmodified  cfqueryparam value=#threeMonthsAgo#
cfsqltype=CF_SQL_DATE
/cfquery

cfdump var=#filteredArt#


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300991
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: QofQ Date Comparison Problem...

2008-03-11 Thread Sonny Savage
IIRC: '-MM-DD'

On Tue, Mar 11, 2008 at 3:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

 How can I compare dates in a QofQ date comparison? See code snippet below.
 Thanks, Che

 cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()), m/d/)
 cfset dirArt  = ExpandPath(../)  emailblast

 cfdirectory
action=LIST
directory=#dirArt#
name=getArt
filter=*.jpg

 cfquery name=filteredArt dbtype=query
 select  name from getArt
 where   type = 'file' and
datelastmodified  cfqueryparam value=#threeMonthsAgo#
 cfsqltype=CF_SQL_DATE
 /cfquery

 cfdump var=#filteredArt#


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300994
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: QofQ Date Comparison Problem...

2008-03-11 Thread Charlie Griefer
On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:
 How can I compare dates in a QofQ date comparison? See code snippet below.
  Thanks, Che

  cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()), m/d/)
  cfset dirArt  = ExpandPath(../)  emailblast

  cfdirectory
 action=LIST
 directory=#dirArt#
 name=getArt
 filter=*.jpg

  cfquery name=filteredArt dbtype=query
  select  name from getArt
  where   type = 'file' and
 datelastmodified  cfqueryparam value=#threeMonthsAgo#
  cfsqltype=CF_SQL_DATE
  /cfquery

  cfdump var=#filteredArt#

couple of suggestions:

1) if something isn't working, explain what's not working about it :)
2) cfset threeMonthsAgo = dateAdd('m', -3, now()) /  -- no need for
dateFormat() there.  only format a date if you're displaying it.
3) i don't believe there's any benefit to using cfqueryparam in a
query of queries.  it's not like there's the possibility of SQL
injection, nor do i think there'd be any inherent performance
benefits.

-- 
Evelyn the dog, having undergone further modification pondered the
significance of short-person behaviour in pedal depressed,
pan-chromatic resonance, and other highly ambient domains. Arf, she
said.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300995
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: QofQ Date Comparison Problem...

2008-03-11 Thread Che Vilnonis
Point #1. True. I guess I thought it was obvious.
Points #23... I've tried that. I get the following...

Error Executing Database Query.
brbQuery Of Queries syntax error./bbr Encountered 2007 at line 0,
column 0. 

-Original Message-
On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:
 How can I compare dates in a QofQ date comparison? See code snippet below.
  Thanks, Che

  cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()), 
 m/d/)  cfset dirArt  = ExpandPath(../)  emailblast

  cfdirectory
 action=LIST
 directory=#dirArt#
 name=getArt
 filter=*.jpg

  cfquery name=filteredArt dbtype=query  select  name from getArt
  where   type = 'file' and
 datelastmodified  cfqueryparam value=#threeMonthsAgo#
  cfsqltype=CF_SQL_DATE
  /cfquery

  cfdump var=#filteredArt#

couple of suggestions:

1) if something isn't working, explain what's not working about it :)
2) cfset threeMonthsAgo = dateAdd('m', -3, now()) /  -- no need for
dateFormat() there.  only format a date if you're displaying it.
3) i don't believe there's any benefit to using cfqueryparam in a query of
queries.  it's not like there's the possibility of SQL injection, nor do i
think there'd be any inherent performance benefits.


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300997
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: QofQ Date Comparison Problem...

2008-03-11 Thread Sonny Savage
Did you try '-MM-DD'?

cfquery name=filteredArt dbtype=query
select  name from getArt
where   type = 'file' and
   datelastmodified  '#dateFormat(threeMonthsAgo,
-MM-DD)#'
/cfquery

On Tue, Mar 11, 2008 at 3:54 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

 Point #1. True. I guess I thought it was obvious.
 Points #23... I've tried that. I get the following...

 Error Executing Database Query.
 brbQuery Of Queries syntax error./bbr Encountered 2007 at line
 0,
 column 0.

 -Original Message-
 On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:
  How can I compare dates in a QofQ date comparison? See code snippet
 below.
   Thanks, Che
 
   cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()),
  m/d/)  cfset dirArt  = ExpandPath(../)  emailblast
 
   cfdirectory
  action=LIST
  directory=#dirArt#
  name=getArt
  filter=*.jpg
 
   cfquery name=filteredArt dbtype=query  select  name from getArt
   where   type = 'file' and
  datelastmodified  cfqueryparam
 value=#threeMonthsAgo#
   cfsqltype=CF_SQL_DATE
   /cfquery
 
   cfdump var=#filteredArt#

 couple of suggestions:

 1) if something isn't working, explain what's not working about it :)
 2) cfset threeMonthsAgo = dateAdd('m', -3, now()) /  -- no need for
 dateFormat() there.  only format a date if you're displaying it.
 3) i don't believe there's any benefit to using cfqueryparam in a query of
 queries.  it's not like there's the possibility of SQL injection, nor do i
 think there'd be any inherent performance benefits.


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300998
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: QofQ Date Comparison Problem...

2008-03-11 Thread Che Vilnonis
Yes, I did. I even tried using the CAST function. No luck either way. 

-Original Message-
From: Sonny Savage [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 11, 2008 3:56 PM
To: CF-Talk
Subject: Re: QofQ Date Comparison Problem...

Did you try '-MM-DD'?

cfquery name=filteredArt dbtype=query select  name from getArt
where   type = 'file' and
   datelastmodified  '#dateFormat(threeMonthsAgo,
-MM-DD)#'
/cfquery

On Tue, Mar 11, 2008 at 3:54 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

 Point #1. True. I guess I thought it was obvious.
 Points #23... I've tried that. I get the following...

 Error Executing Database Query.
 brbQuery Of Queries syntax error./bbr Encountered 2007 at 
 line 0, column 0.

 -Original Message-
 On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:
  How can I compare dates in a QofQ date comparison? See code snippet
 below.
   Thanks, Che
 
   cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()), 
  m/d/)  cfset dirArt  = ExpandPath(../)  emailblast
 
   cfdirectory
  action=LIST
  directory=#dirArt#
  name=getArt
  filter=*.jpg
 
   cfquery name=filteredArt dbtype=query  select  name from getArt
   where   type = 'file' and
  datelastmodified  cfqueryparam
 value=#threeMonthsAgo#
   cfsqltype=CF_SQL_DATE
   /cfquery
 
   cfdump var=#filteredArt#

 couple of suggestions:

 1) if something isn't working, explain what's not working about it :)
 2) cfset threeMonthsAgo = dateAdd('m', -3, now()) /  -- no need for
 dateFormat() there.  only format a date if you're displaying it.
 3) i don't believe there's any benefit to using cfqueryparam in a 
 query of queries.  it's not like there's the possibility of SQL 
 injection, nor do i think there'd be any inherent performance benefits.


 



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300999
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: QofQ Date Comparison Problem...

2008-03-11 Thread Sonny Savage
Darn it... I'm pretty sure I did this while working for a previous employer,
if only I could remember how...

Is simply hitting the DB again out of the question?

On Tue, Mar 11, 2008 at 4:00 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

 Yes, I did. I even tried using the CAST function. No luck either way.

 -Original Message-
 From: Sonny Savage [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 11, 2008 3:56 PM
 To: CF-Talk
 Subject: Re: QofQ Date Comparison Problem...

 Did you try '-MM-DD'?

 cfquery name=filteredArt dbtype=query select  name from getArt
 where   type = 'file' and
   datelastmodified  '#dateFormat(threeMonthsAgo,
 -MM-DD)#'
 /cfquery

 On Tue, Mar 11, 2008 at 3:54 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

  Point #1. True. I guess I thought it was obvious.
  Points #23... I've tried that. I get the following...
 
  Error Executing Database Query.
  brbQuery Of Queries syntax error./bbr Encountered 2007 at
  line 0, column 0.
 
  -Original Message-
  On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:
   How can I compare dates in a QofQ date comparison? See code snippet
  below.
Thanks, Che
  
cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()),
   m/d/)  cfset dirArt  = ExpandPath(../)  emailblast
  
cfdirectory
   action=LIST
   directory=#dirArt#
   name=getArt
   filter=*.jpg
  
cfquery name=filteredArt dbtype=query  select  name from getArt
where   type = 'file' and
   datelastmodified  cfqueryparam
  value=#threeMonthsAgo#
cfsqltype=CF_SQL_DATE
/cfquery
  
cfdump var=#filteredArt#
 
  couple of suggestions:
 
  1) if something isn't working, explain what's not working about it :)
  2) cfset threeMonthsAgo = dateAdd('m', -3, now()) /  -- no need for
  dateFormat() there.  only format a date if you're displaying it.
  3) i don't believe there's any benefit to using cfqueryparam in a
  query of queries.  it's not like there's the possibility of SQL
  injection, nor do i think there'd be any inherent performance benefits.
 
 
 



 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301003
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: QofQ Date Comparison Problem...

2008-03-11 Thread Che Vilnonis
Nah. I just filtered out the results during the cfloop. I just wanted to try
a more elegant solution first. 

-Original Message-
From: Sonny Savage [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 11, 2008 4:22 PM
To: CF-Talk
Subject: Re: QofQ Date Comparison Problem...

Darn it... I'm pretty sure I did this while working for a previous employer,
if only I could remember how...

Is simply hitting the DB again out of the question?

On Tue, Mar 11, 2008 at 4:00 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

 Yes, I did. I even tried using the CAST function. No luck either way.

 -Original Message-
 From: Sonny Savage [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 11, 2008 3:56 PM
 To: CF-Talk
 Subject: Re: QofQ Date Comparison Problem...

 Did you try '-MM-DD'?

 cfquery name=filteredArt dbtype=query select  name from getArt
 where   type = 'file' and
   datelastmodified  '#dateFormat(threeMonthsAgo, 
 -MM-DD)#'
 /cfquery

 On Tue, Mar 11, 2008 at 3:54 PM, Che Vilnonis [EMAIL PROTECTED] wrote:

  Point #1. True. I guess I thought it was obvious.
  Points #23... I've tried that. I get the following...
 
  Error Executing Database Query.
  brbQuery Of Queries syntax error./bbr Encountered 2007 at 
  line 0, column 0.
 
  -Original Message-
  On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis [EMAIL PROTECTED] wrote:
   How can I compare dates in a QofQ date comparison? See code 
   snippet
  below.
Thanks, Che
  
cfset threeMonthsAgo = dateformat(dateAdd(m, -3, now()), 
   m/d/)  cfset dirArt  = ExpandPath(../)  emailblast
  
cfdirectory
   action=LIST
   directory=#dirArt#
   name=getArt
   filter=*.jpg
  
cfquery name=filteredArt dbtype=query  select  name from getArt
where   type = 'file' and
   datelastmodified  cfqueryparam
  value=#threeMonthsAgo#
cfsqltype=CF_SQL_DATE
/cfquery
  
cfdump var=#filteredArt#
 
  couple of suggestions:
 
  1) if something isn't working, explain what's not working about it 
  :)
  2) cfset threeMonthsAgo = dateAdd('m', -3, now()) /  -- no need 
  for
  dateFormat() there.  only format a date if you're displaying it.
  3) i don't believe there's any benefit to using cfqueryparam in a 
  query of queries.  it's not like there's the possibility of SQL 
  injection, nor do i think there'd be any inherent performance benefits.
 
 
 



 



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301005
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Query of Queries date comparison

2007-07-31 Thread Claude Schneegans
 I think he is working with dates

You're right, I didn't notice the CFMX form of the function.

-- 
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284933
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Query of Queries date comparison

2007-07-30 Thread Mark Lewis
Hi,

Wondered if someone could advise on this problem I am having.

I have created a query as shown below...


cfset event = QueryNew(date, name, destination, date, varchar, varchar)

cfset newRow = QueryAddRow(event, 2)

cfset temp = QuerySetCell(event, date, 07/28/2007, 1)
cfset temp = QuerySetCell(event, name, trip to zoo, 1)
cfset temp = QuerySetCell(event, destination, london, 1)

cfset temp = QuerySetCell(event, date, 07/31/2007, 2)
cfset temp = QuerySetCell(event, name, trip to zoo, 2)
cfset temp = QuerySetCell(event, destination, london, 2)


I would like to run a query on this query where it finds only the records where 
the date is greater than today.

I have written the following...

  cfquery name=search dbtype=query
   SELECT *
   FROM event
   WHERE date  #DateFormat(Now(),mm/dd/)#
  /cfquery

However I get an error returned 

Query Of Queries syntax error.
Encountered date. Incorrect conditional expression, Expected one of 
[like|null|between|in|comparison] condition, 

Does this mean I cannot use this greater than (  ) clause on a query of 
queries, I have searched for some documentation but couldnt find any. I f 
anyone knows where any could be posted on the web, or a solution to this 
problem that would be great.

Thank you in advance

Mark

~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284783
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Query of Queries date comparison

2007-07-30 Thread Gualtiero Sappa
You can try using data object instead of a string formatted as a date. I 
think the column in your query is of type string.

Bye
Gualtiero

- Original Message - 
From: Mark Lewis [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Monday, July 30, 2007 1:43 PM
Subject: Query of Queries date comparison


 Hi,

 Wondered if someone could advise on this problem I am having.

 I have created a query as shown below...


 cfset event = QueryNew(date, name, destination, date, varchar, 
 varchar)

 cfset newRow = QueryAddRow(event, 2)

 cfset temp = QuerySetCell(event, date, 07/28/2007, 1)
 cfset temp = QuerySetCell(event, name, trip to zoo, 1)
 cfset temp = QuerySetCell(event, destination, london, 1)

 cfset temp = QuerySetCell(event, date, 07/31/2007, 2)
 cfset temp = QuerySetCell(event, name, trip to zoo, 2)
 cfset temp = QuerySetCell(event, destination, london, 2)


 I would like to run a query on this query where it finds only the records 
 where the date is greater than today.

 I have written the following...

  cfquery name=search dbtype=query
   SELECT *
   FROM event
   WHERE date  #DateFormat(Now(),mm/dd/)#
  /cfquery

 However I get an error returned

 Query Of Queries syntax error.
 Encountered date. Incorrect conditional expression, Expected one of 
 [like|null|between|in|comparison] condition, 

 Does this mean I cannot use this greater than (  ) clause on a query of 
 queries, I have searched for some documentation but couldnt find any. I f 
 anyone knows where any could be posted on the web, or a solution to this 
 problem that would be great.

 Thank you in advance

 Mark

 

~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284786
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Query of Queries date comparison

2007-07-30 Thread Dave Francis
Date is possibly(probably) a reserved word? Even if it isn't, your test
will fail when the year rolls over - you should test /mm/dd.  And I
think you might need apostrophes around today's formatted date?

None of this is guaranteed, I am famous for being wrong.


-Original Message-
From: Mark Lewis [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 7:43 AM
To: CF-Talk
Subject: Query of Queries date comparison

Hi,

Wondered if someone could advise on this problem I am having.

I have created a query as shown below...


cfset event = QueryNew(date, name, destination, date, varchar,
varchar)

cfset newRow = QueryAddRow(event, 2)

cfset temp = QuerySetCell(event, date, 07/28/2007, 1)
cfset temp = QuerySetCell(event, name, trip to zoo, 1)
cfset temp = QuerySetCell(event, destination, london, 1)

cfset temp = QuerySetCell(event, date, 07/31/2007, 2)
cfset temp = QuerySetCell(event, name, trip to zoo, 2)
cfset temp = QuerySetCell(event, destination, london, 2)


I would like to run a query on this query where it finds only the records
where the date is greater than today.

I have written the following...

  cfquery name=search dbtype=query
   SELECT *
   FROM event
   WHERE date  #DateFormat(Now(),mm/dd/)#
  /cfquery

However I get an error returned 

Query Of Queries syntax error.
Encountered date. Incorrect conditional expression, Expected one of
[like|null|between|in|comparison] condition, 

Does this mean I cannot use this greater than (  ) clause on a query of
queries, I have searched for some documentation but couldnt find any. I f
anyone knows where any could be posted on the web, or a solution to this
problem that would be great.

Thank you in advance

Mark



~|
Check out the new features and enhancements in the
latest product release - download the What's New PDF now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284787
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Query of Queries date comparison

2007-07-30 Thread AJ Mercer
Not too sure about this, but have you tried it with GT

maybe also try changing the filed name from date to tripDate - in case it is
a reserved word

On 7/30/07, Mark Lewis [EMAIL PROTECTED] wrote:

 Hi,

 Wondered if someone could advise on this problem I am having.

 I have created a query as shown below...


 cfset event = QueryNew(date, name, destination, date, varchar,
 varchar)

 cfset newRow = QueryAddRow(event, 2)

 cfset temp = QuerySetCell(event, date, 07/28/2007, 1)
 cfset temp = QuerySetCell(event, name, trip to zoo, 1)
 cfset temp = QuerySetCell(event, destination, london, 1)

 cfset temp = QuerySetCell(event, date, 07/31/2007, 2)
 cfset temp = QuerySetCell(event, name, trip to zoo, 2)
 cfset temp = QuerySetCell(event, destination, london, 2)


 I would like to run a query on this query where it finds only the records
 where the date is greater than today.

 I have written the following...

   cfquery name=search dbtype=query
SELECT *
FROM event
WHERE date  #DateFormat(Now(),mm/dd/)#
   /cfquery

 However I get an error returned

 Query Of Queries syntax error.
 Encountered date. Incorrect conditional expression, Expected one of
 [like|null|between|in|comparison] condition, 

 Does this mean I cannot use this greater than (  ) clause on a query of
 queries, I have searched for some documentation but couldnt find any. I f
 anyone knows where any could be posted on the web, or a solution to this
 problem that would be great.

 Thank you in advance

 Mark

 

~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284791
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Query of Queries date comparison

2007-07-30 Thread Ben Nadel
Mark,

I think the problem is the date column. Date is a reserved word, I
think, and must be wrapped in []. Also, I would use a query param as it
takes care of the data type conversion.

cfquery name=search dbtype=query
   SELECT *
   FROM event
   WHERE [date]  cfqueryparam value=#DateFormat(Now(),mm/dd/)#
cfsqltype=CF_SQL_TIMESTAMP /
/cfquery


..
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-Original Message-
From: Mark Lewis [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 7:43 AM
To: CF-Talk
Subject: Query of Queries date comparison

Hi,

Wondered if someone could advise on this problem I am having.

I have created a query as shown below...


cfset event = QueryNew(date, name, destination, date, varchar,
varchar)

cfset newRow = QueryAddRow(event, 2)

cfset temp = QuerySetCell(event, date, 07/28/2007, 1) cfset temp =
QuerySetCell(event, name, trip to zoo, 1) cfset temp =
QuerySetCell(event, destination, london, 1)

cfset temp = QuerySetCell(event, date, 07/31/2007, 2) cfset temp =
QuerySetCell(event, name, trip to zoo, 2) cfset temp =
QuerySetCell(event, destination, london, 2)


I would like to run a query on this query where it finds only the
records where the date is greater than today.

I have written the following...

  cfquery name=search dbtype=query
   SELECT *
   FROM event
   WHERE date  #DateFormat(Now(),mm/dd/)#
  /cfquery

However I get an error returned 

Query Of Queries syntax error.
Encountered date. Incorrect conditional expression, Expected one of
[like|null|between|in|comparison] condition, 

Does this mean I cannot use this greater than (  ) clause on a query of
queries, I have searched for some documentation but couldnt find any. I
f anyone knows where any could be posted on the web, or a solution to
this problem that would be great.

Thank you in advance

Mark

~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284790
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Query of Queries date comparison

2007-07-30 Thread Mark Lewis
Gualtiero and Dave thanks for your help I have resolved the issue with both 
your tips.

Thank you for your time again

Mark



 Date is possibly(probably) a reserved word? Even if it isn't, your test
 will fail when the year rolls over - you should test /mm/dd.  And I
 think you might need apostrophes around today's formatted date?

 None of this is guaranteed, I am famous for being wrong.



~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284795
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Query of Queries date comparison

2007-07-30 Thread Mark Lewis
Oh sorry, I only just got everyone else's responses through, thank you to 
you guys for your time too.

Much appreciated,

Mark 


~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284796
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Query of Queries date comparison

2007-07-30 Thread Ben Doom
I think you need quotes around your date in the comparison in the SQL. 
But I always have trouble with QoQ syntax for some reason.

--Ben Doom

Mark Lewis wrote:
 Hi,
 
 Wondered if someone could advise on this problem I am having.
 
 I have created a query as shown below...
 
 
 cfset event = QueryNew(date, name, destination, date, varchar, varchar)
 
 cfset newRow = QueryAddRow(event, 2)
 
 cfset temp = QuerySetCell(event, date, 07/28/2007, 1)
 cfset temp = QuerySetCell(event, name, trip to zoo, 1)
 cfset temp = QuerySetCell(event, destination, london, 1)
 
 cfset temp = QuerySetCell(event, date, 07/31/2007, 2)
 cfset temp = QuerySetCell(event, name, trip to zoo, 2)
 cfset temp = QuerySetCell(event, destination, london, 2)
 
 
 I would like to run a query on this query where it finds only the records 
 where the date is greater than today.
 
 I have written the following...
 
   cfquery name=search dbtype=query
SELECT *
FROM event
WHERE date  #DateFormat(Now(),mm/dd/)#
   /cfquery
 
 However I get an error returned 
 
 Query Of Queries syntax error.
 Encountered date. Incorrect conditional expression, Expected one of 
 [like|null|between|in|comparison] condition, 
 
 Does this mean I cannot use this greater than (  ) clause on a query of 
 queries, I have searched for some documentation but couldnt find any. I f 
 anyone knows where any could be posted on the web, or a solution to this 
 problem that would be great.
 
 Thank you in advance
 
 Mark
 
 

~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284794
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Query of Queries date comparison

2007-07-30 Thread Claude Schneegans
 I would like to run a query on this query where it finds only the 
records where the date is greater than today.

You cannot compare dates if they are stored in American format.

Use QuerySetCell(event, date, 2007/07/28, 1) Instead: always with mask 
/mm/dd
Then
WHERE date  #DateFormat(Now(),/mm/dd)#
(you can even forget about slashes)

-- 
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284802
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Query of Queries date comparison

2007-07-30 Thread Claude Schneegans
 and yes, since you are actually working with strings, not dates, you 
do need quotes in
WHERE date  '#DateFormat(Now(),/mm/dd)#'

-- 
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~|
ColdFusion is delivering applications solutions at at top companies 
around the world in government.  Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finderproductID=1522loc=en_us

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284803
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Query of Queries date comparison

2007-07-30 Thread Ben Nadel
Claude,

I think he is working with dates; I think the data-type for that column
in Querynew() was date.


..
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-Original Message-
From: Claude Schneegans [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 10:48 AM
To: CF-Talk
Subject: Re: Query of Queries date comparison

. and yes, since you are actually working with strings, not dates,
you do need quotes in WHERE date  '#DateFormat(Now(),/mm/dd)#'

~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284826
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Date Comparison

2007-07-24 Thread Robert Rawlins - Think Blue
Guys,

 

I'm trying to evaluate a date against now() to try and see if the date is
more than 5 minutes old, I'm sure I've used this method before but for some
reason I'm struggling to get it working.

 

  cfif LOCAL.qMyQuery.DateTime LT dateadd('m', -5, now()) 

Date is older than 5 minutes.

  cfelse

Date is within the last 5 minutes.

  /cfif

 

However this doesn't appear to work, it always displays the 'Date is within
the last 5 minutes.' Even when it's not J

 

Any ideas?

 

Thanks guys,

 

Rob



~|
ColdFusion 8 beta - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284418
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


AW: Date Comparison

2007-07-24 Thread t.o.
isn't 'm' a month? try with 'n'

T. 

 -Ursprüngliche Nachricht-
 Von: Robert Rawlins - Think Blue 
 [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 24. Juli 2007 11:16
 An: CF-Talk
 Betreff: Date Comparison
 
 Guys,
 
  
 
 I'm trying to evaluate a date against now() to try and see if 
 the date is more than 5 minutes old, I'm sure I've used this 
 method before but for some reason I'm struggling to get it working.
 
  
 
   cfif LOCAL.qMyQuery.DateTime LT 
 dateadd('m', -5, now()) 
 
 Date is older than 5 minutes.
 
   cfelse
 
 Date is within the last 5 minutes.
 
   /cfif
 
  
 
 However this doesn't appear to work, it always displays the 
 'Date is within the last 5 minutes.' Even when it's not J
 
  
 
 Any ideas?
 
  
 
 Thanks guys,
 
  
 
 Rob
 
 
 
 

~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284419
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Date Comparison

2007-07-24 Thread Robert Rawlins - Think Blue
 isn't 'm' a month?

D'oh!

You're spot on mate, thanks,

Rob
-Original Message-
From: t.o. [mailto:[EMAIL PROTECTED] 
Sent: 24 July 2007 10:29
To: CF-Talk
Subject: AW: Date Comparison

isn't 'm' a month? try with 'n'

T. 

 -Ursprüngliche Nachricht-
 Von: Robert Rawlins - Think Blue 
 [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 24. Juli 2007 11:16
 An: CF-Talk
 Betreff: Date Comparison
 
 Guys,
 
  
 
 I'm trying to evaluate a date against now() to try and see if 
 the date is more than 5 minutes old, I'm sure I've used this 
 method before but for some reason I'm struggling to get it working.
 
  
 
   cfif LOCAL.qMyQuery.DateTime LT 
 dateadd('m', -5, now()) 
 
 Date is older than 5 minutes.
 
   cfelse
 
 Date is within the last 5 minutes.
 
   /cfif
 
  
 
 However this doesn't appear to work, it always displays the 
 'Date is within the last 5 minutes.' Even when it's not J
 
  
 
 Any ideas?
 
  
 
 Thanks guys,
 
  
 
 Rob
 
 
 
 



~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284420
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Date Comparison

2006-12-28 Thread Nick G
What is the syntax of finding the difference in years between two date fields? 
For example I'm selecting a field from a database and trying to find the 
difference between that and todays date?

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265232
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Date Comparison

2006-12-28 Thread Charlie Griefer
http://livedocs.macromedia.com/coldfusion/7/htmldocs/0440.htm

On 12/28/06, Nick G [EMAIL PROTECTED] wrote:
 What is the syntax of finding the difference in years between two date fields?
 For example I'm selecting a field from a database and trying to find the 
 difference between that and todays date?

 

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265234
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Date Comparison

2006-12-28 Thread Christopher Jordan
DateDiff(, Date1, Date2)

Where Date1 and Date2 are valid CF Date/Time objects.

the datepart  is in years.
the datepart y is days of the year (1-365?) same as d for days.

Cheers,
Chris


Nick G wrote:
 What is the syntax of finding the difference in years between two date 
 fields? 
 For example I'm selecting a field from a database and trying to find the 
 difference between that and todays date?

 

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265236
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Date Comparison

2006-12-28 Thread Jim Wright
Christopher Jordan wrote:
 DateDiff(, Date1, Date2)
 
 Where Date1 and Date2 are valid CF Date/Time objects.
 
 the datepart  is in years.
 the datepart y is days of the year (1-365?) same as d for days.

Just a note since he didn't say if he wanted to do this on the CF side, 
or the db side...
CF...
#datediff(,12/31/2006,1/1/2007)# = 0

SQL Server...
SELECT datediff(,'12/31/2006','1/1/2007') = 1

SQL Server is counting thresholds, whereas CF is counting whole units. 
I believe that is also the behavior in Access.  The MySQL datediff 
function is only for whole days, and I'm not sure if Postgres has one.


~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265240
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Date Comparison using JavaScript

2003-09-29 Thread Pascal Peters
Create JS dateobjects and use the getTime() method to compare them. The
function uses US dateformat (mm/dd/)
 
function InRange(mydate){
 var aDate = mydate.split(/);
 var currDate = new Date(); 
 var minDate = new
Date(currDate.getYear(),currDate.getMonth()-2,currDate.getDate());
 var maxDate = new
Date(currDate.getYear(),currDate.getMonth()+2,currDate.getDate());
 if(aDate.length!=3){
alert(No date);
return false;
 }
 var theDate = new Date(aDate[2],aDate[0]-1,aDate[1]);
 if(theDate.getTime==NaN){
alert(No date);
return false;
 }
 if (theDate.getTime()maxDate.getTime() ||
theDate.getTime()minDate.getTime()){
alert(date out of range);
return false;
 }
 alert(date in range);
 return true;
}

Pascal
-Original Message-
From: Dave Sueltenfuss [mailto:[EMAIL PROTECTED] 
Sent: maandag 29 september 2003 16:20
To: CF-Talk
Subject: OT:Date Comparison using _javascript_


Sorry for the Off Topic post, but I am hoping someone on the list will
be able to help me out.
Does anyone have a script for comparing two dates within _javascript_? I
have a date input field, and the date needs to be within two months
either way of today. Any help is appreciated.

Thanks

Dave Sueltenfuss 
Application Developer 
Certified ColdFusion MX Developer 
Arch Wireless 
Phone: 508-870-6711 
Fax: 508-836-2760
Email: [EMAIL PROTECTED] 


_


 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]



RE: Date Comparison using JavaScript

2003-09-29 Thread Lofback, Chris
Do you mean to compare date strings rather than date objects?I have a JS library I wrote that will do this, but it requires v4 browser or better.Is that OK?
 
Chris

-Original Message-
From: Dave Sueltenfuss [mailto:[EMAIL PROTECTED]
Sent: Monday, September 29, 2003 10:20 AM
To: CF-Talk
Subject: OT:Date Comparison using _javascript_


Sorry for the Off Topic post, but I am hoping someone on the list will
be able to help me out.
Does anyone have a script for comparing two dates within _javascript_? I
have a date input field, and the date needs to be within two months
either way of today. Any help is appreciated.

Thanks

Dave Sueltenfuss 
Application Developer 
Certified ColdFusion MX Developer 
Arch Wireless 
Phone: 508-870-6711 
Fax: 508-836-2760
Email: [EMAIL PROTECTED] 


_

[ Todays Threads 
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Date Comparison

2002-10-03 Thread Everett, Al

Short answer: You can't.

CF needs to run under a user account in order to access drives on the
network.

(I still have a flat spot on my head from banging it against my desk over
this.)

 -Original Message-
 From: Brook [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:56 PM
 To: CF-Talk
 Subject: Re: Date Comparison
 
 
 When running under the SYSTEM account, and trying to connect 
 to a remote 
 drive via a UNC path, what permissions do you need on the 
 shared folder? I 
 can connect running under a user account by having an account 
 by the same 
 name on the remote machine and giving that account privileges to the 
 folder. But I can't seem to do the same thing with the System account.
 
 I've tried adding SYSTEM and even EVERYONE and I still get an 
 access denied 
 error when running CF under the default SYSTEM Account.  But 
 I can open the 
 shared drive through the network neighborhood and read/write 
 a file

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



Date Comparison

2002-10-02 Thread Chris

I'm trying to grab all records in a table that were created within the
last year.  I started by creating a variable called yearback.

 

CFSET yearback=#DateAdd('', -1, NOW())#

 

this is my SQL where clause

 

WHERE customer_orders.shipdate  #yearback#

 

Problem is, some of the ship dates are just dates, which work fine, and
others are DateTime.  My query returns nothing if the record I'm looking
for contains a DateTime.  How do I work around this?

 

Thanks

Chris 




~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



Re: Date Comparison

2002-10-02 Thread Byron M

I trust that the shipdate field in your db is a datetime data type.  If so
this should work.

WHERE customer_orders.shipdate  #CreateODBCDateTime(yearback)#

Byron Mann

- Original Message -
From: Chris [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, October 02, 2002 12:25 PM
Subject: Date Comparison


 I'm trying to grab all records in a table that were created within the
 last year.  I started by creating a variable called yearback.



 CFSET yearback=#DateAdd('', -1, NOW())#



 this is my SQL where clause



 WHERE customer_orders.shipdate  #yearback#



 Problem is, some of the ship dates are just dates, which work fine, and
 others are DateTime.  My query returns nothing if the record I'm looking
 for contains a DateTime.  How do I work around this?



 Thanks

 Chris




 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
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



RE: Date Comparison

2002-10-02 Thread Chris

The shipdate is an ODBCDateTime.  I tried #CreateODBCDateTime(yearback)#
and it still doesn't work.  

-Original Message-
From: Byron M [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 02, 2002 12:58 PM
To: CF-Talk
Subject: Re: Date Comparison

I trust that the shipdate field in your db is a datetime data type.  If
so
this should work.

WHERE customer_orders.shipdate  #CreateODBCDateTime(yearback)#

Byron Mann

- Original Message -
From: Chris [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, October 02, 2002 12:25 PM
Subject: Date Comparison


 I'm trying to grab all records in a table that were created within the
 last year.  I started by creating a variable called yearback.



 CFSET yearback=#DateAdd('', -1, NOW())#



 this is my SQL where clause



 WHERE customer_orders.shipdate  #yearback#



 Problem is, some of the ship dates are just dates, which work fine,
and
 others are DateTime.  My query returns nothing if the record I'm
looking
 for contains a DateTime.  How do I work around this?



 Thanks

 Chris




 

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
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



Re: Date Comparison

2002-10-02 Thread Joe Eugene

You can do this in the query itself

select ... from MyTable where Year(dateField)=Year(GetDate())-1
or
select ... from MyTable where DatePart(,dateField)=DateAdd(,-1,
GetDate())


Joe

- Original Message -
From: Chris [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, October 02, 2002 12:25 PM
Subject: Date Comparison


 I'm trying to grab all records in a table that were created within the
 last year.  I started by creating a variable called yearback.



 CFSET yearback=#DateAdd('', -1, NOW())#



 this is my SQL where clause



 WHERE customer_orders.shipdate  #yearback#



 Problem is, some of the ship dates are just dates, which work fine, and
 others are DateTime.  My query returns nothing if the record I'm looking
 for contains a DateTime.  How do I work around this?



 Thanks

 Chris




 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



Re: Date Comparison

2002-10-02 Thread Jochem van Dieten

Joe Eugene wrote:
 You can do this in the query itself
 
 select ... from MyTable where Year(dateField)=Year(GetDate())-1
 or
 select ... from MyTable where DatePart(,dateField)=DateAdd(,-1,
 GetDate())

That would also get all records even from longer as a year ago (but 
still in 2001. If you mean last year as in last 365 days, use:

WHERE datefield  CURRENT_TIMESTAMP - INTERVAL '1' YEAR

Jochem

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



Re: Date Comparison

2002-10-02 Thread Brook

When running under the SYSTEM account, and trying to connect to a remote 
drive via a UNC path, what permissions do you need on the shared folder? I 
can connect running under a user account by having an account by the same 
name on the remote machine and giving that account privileges to the 
folder. But I can't seem to do the same thing with the System account.

I've tried adding SYSTEM and even EVERYONE and I still get an access denied 
error when running CF under the default SYSTEM Account.  But I can open the 
shared drive through the network neighborhood and read/write a file



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: Date Comparison Issue

2002-03-21 Thread BEN MORRIS

Yes, the hour is from 0-23, military time.

 Owens, Howard [EMAIL PROTECTED] 03/21/02 02:30AM 
Thanks for the tip, Ben.   I've been testing this out and so far it works
like a charm.  

Question:  For the hour I'm using military time, in this case 15 for 3
p.m. eastern time. I assume if I put 3 the server will think I mean 3 a.m.

H.


 -Original Message-
 From: BEN MORRIS [SMTP:[EMAIL PROTECTED]] 
 Sent: Wednesday, March 20, 2002 11:39 AM
 To:   CF-Talk
 Subject:  Re: Date Comparison Issue
 
 I have done...
 
 cfset l_TurnOffDate = CreateDateTime(2002, 4, 16, 3, 0, 0)
 
 cfif Now() GT l_TurnOffDate
   past deadline code...
 cfelse
   before deadline code
 /cfif
 
 It works for me.
 This is designed for a Pacific deadline as well, so I just made it 3am
 eastern (timezone where my server is)
 
  Owens, Howard [EMAIL PROTECTED] 03/20/02 02:17PM 
 I have this application that has an element that is supposed to end on a
 predefined date and time.
 
 I set the end date and time in the Application.cfm, then have a template
 that runs the code below.
 
 Two questions:
 
   1.) Is this the most efficient and straightforward way to do this.
   2.) I have some logic problem ... the month comparison isn't working
 right.  If the application begins running in Feburary (for example), the
 section that is supposed to be on is OK, but then on the 1st of the month,
 it stops working.  For example, if the code is supposed to end on 3/7,
 everything works from 2/8 until 3/1, then it stops and won't start working
 again until 3/8. 
 
 If you're wonding about the dateadd part and the -3, our servers are on
 the
 east coast, our time is west coast.
 
 Here's the code:
 
 
 !--- application end times are set on the application.cfm page ---
 
 !--- param for auction over ---
 cfparam name=request.AppStatus default=
 
 
 
 !--- first we need to set the month parts we're dealing with ---
 cfset TodayMonth=#DatePart('m', Now())#
 cfset MonthEnd=#DatePart('m', #request.AuctionEnd#)#
 
 
 
 !--- now we test to make sure we haven't reached the final month of the
 auction ---
 CFIF NOT TodayMonth lt MonthEnd
 
 
 !--- if this is the final month, we need to set the day and hour parts
 ---
 cfset TodayDate=#DatePart('d', Now())#
 
 cfset TodayTime=#DateAdd('h', '-3', Now())#
 cfset TodayTime=#DatePart('h', TodayTime)#
 
 cfset DateEnd=#DatePart(d, #request.AppEnd#)#
 cfset TimeEnd=#DatePart(h, #request.AppEndTime#)#
 
 
 
 
 !--- if today's date is greater than or equal the end date, keep the
 processing going ---
 cfif TodayDate GTE DateEnd 
 
 !--- if the processing is going, check to see if the time has expired on
 hours ---
 cfif TodayTime GT TimeEnd 
 
   cfset request.AppStatus=Over
   
   cfelse
   !--- if the first test of the day passes, the time test will only
 be true from 9 p.m. to midnight; so after the date expired, we want to
 make
 it permenant that the App is over ---
   cfif TodayDate GT DateEnd 
   cfset request.AppStatus=Over
   /cfif
   
 /cfif
 
 /cfif
 
 
 /cfif
 
 
 
 

__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Date Comparison Issue

2002-03-20 Thread Owens, Howard

I have this application that has an element that is supposed to end on a
predefined date and time.

I set the end date and time in the Application.cfm, then have a template
that runs the code below.

Two questions:

1.) Is this the most efficient and straightforward way to do this.
2.) I have some logic problem ... the month comparison isn't working
right.  If the application begins running in Feburary (for example), the
section that is supposed to be on is OK, but then on the 1st of the month,
it stops working.  For example, if the code is supposed to end on 3/7,
everything works from 2/8 until 3/1, then it stops and won't start working
again until 3/8. 

If you're wonding about the dateadd part and the -3, our servers are on the
east coast, our time is west coast.

Here's the code:


!--- application end times are set on the application.cfm page ---

!--- param for auction over ---
cfparam name=request.AppStatus default=



!--- first we need to set the month parts we're dealing with ---
cfset TodayMonth=#DatePart('m', Now())#
cfset MonthEnd=#DatePart('m', #request.AuctionEnd#)#



!--- now we test to make sure we haven't reached the final month of the
auction ---
CFIF NOT TodayMonth lt MonthEnd


!--- if this is the final month, we need to set the day and hour parts ---
cfset TodayDate=#DatePart('d', Now())#

cfset TodayTime=#DateAdd('h', '-3', Now())#
cfset TodayTime=#DatePart('h', TodayTime)#

cfset DateEnd=#DatePart(d, #request.AppEnd#)#
cfset TimeEnd=#DatePart(h, #request.AppEndTime#)#




!--- if today's date is greater than or equal the end date, keep the
processing going ---
cfif TodayDate GTE DateEnd 

!--- if the processing is going, check to see if the time has expired on
hours ---
cfif TodayTime GT TimeEnd 

cfset request.AppStatus=Over

cfelse
!--- if the first test of the day passes, the time test will only
be true from 9 p.m. to midnight; so after the date expired, we want to make
it permenant that the App is over ---
cfif TodayDate GT DateEnd 
cfset request.AppStatus=Over
/cfif

/cfif

/cfif


/cfif


__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Date Comparison Issue

2002-03-20 Thread BEN MORRIS

I have done...

cfset l_TurnOffDate = CreateDateTime(2002, 4, 16, 3, 0, 0)

cfif Now() GT l_TurnOffDate
  past deadline code...
cfelse
  before deadline code
/cfif

It works for me.
This is designed for a Pacific deadline as well, so I just made it 3am eastern 
(timezone where my server is)

 Owens, Howard [EMAIL PROTECTED] 03/20/02 02:17PM 
I have this application that has an element that is supposed to end on a
predefined date and time.

I set the end date and time in the Application.cfm, then have a template
that runs the code below.

Two questions:

1.) Is this the most efficient and straightforward way to do this.
2.) I have some logic problem ... the month comparison isn't working
right.  If the application begins running in Feburary (for example), the
section that is supposed to be on is OK, but then on the 1st of the month,
it stops working.  For example, if the code is supposed to end on 3/7,
everything works from 2/8 until 3/1, then it stops and won't start working
again until 3/8. 

If you're wonding about the dateadd part and the -3, our servers are on the
east coast, our time is west coast.

Here's the code:


!--- application end times are set on the application.cfm page ---

!--- param for auction over ---
cfparam name=request.AppStatus default=



!--- first we need to set the month parts we're dealing with ---
cfset TodayMonth=#DatePart('m', Now())#
cfset MonthEnd=#DatePart('m', #request.AuctionEnd#)#



!--- now we test to make sure we haven't reached the final month of the
auction ---
CFIF NOT TodayMonth lt MonthEnd


!--- if this is the final month, we need to set the day and hour parts ---
cfset TodayDate=#DatePart('d', Now())#

cfset TodayTime=#DateAdd('h', '-3', Now())#
cfset TodayTime=#DatePart('h', TodayTime)#

cfset DateEnd=#DatePart(d, #request.AppEnd#)#
cfset TimeEnd=#DatePart(h, #request.AppEndTime#)#




!--- if today's date is greater than or equal the end date, keep the
processing going ---
cfif TodayDate GTE DateEnd 

!--- if the processing is going, check to see if the time has expired on
hours ---
cfif TodayTime GT TimeEnd 

cfset request.AppStatus=Over

cfelse
!--- if the first test of the day passes, the time test will only
be true from 9 p.m. to midnight; so after the date expired, we want to make
it permenant that the App is over ---
cfif TodayDate GT DateEnd 
cfset request.AppStatus=Over
/cfif

/cfif

/cfif


/cfif



__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Date Comparison Issue

2002-03-20 Thread Owens, Howard

Thanks for the tip, Ben.   I've been testing this out and so far it works
like a charm.  

Question:  For the hour I'm using military time, in this case 15 for 3
p.m. eastern time. I assume if I put 3 the server will think I mean 3 a.m.

H.


 -Original Message-
 From: BEN MORRIS [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, March 20, 2002 11:39 AM
 To:   CF-Talk
 Subject:  Re: Date Comparison Issue
 
 I have done...
 
 cfset l_TurnOffDate = CreateDateTime(2002, 4, 16, 3, 0, 0)
 
 cfif Now() GT l_TurnOffDate
   past deadline code...
 cfelse
   before deadline code
 /cfif
 
 It works for me.
 This is designed for a Pacific deadline as well, so I just made it 3am
 eastern (timezone where my server is)
 
  Owens, Howard [EMAIL PROTECTED] 03/20/02 02:17PM 
 I have this application that has an element that is supposed to end on a
 predefined date and time.
 
 I set the end date and time in the Application.cfm, then have a template
 that runs the code below.
 
 Two questions:
 
   1.) Is this the most efficient and straightforward way to do this.
   2.) I have some logic problem ... the month comparison isn't working
 right.  If the application begins running in Feburary (for example), the
 section that is supposed to be on is OK, but then on the 1st of the month,
 it stops working.  For example, if the code is supposed to end on 3/7,
 everything works from 2/8 until 3/1, then it stops and won't start working
 again until 3/8. 
 
 If you're wonding about the dateadd part and the -3, our servers are on
 the
 east coast, our time is west coast.
 
 Here's the code:
 
 
 !--- application end times are set on the application.cfm page ---
 
 !--- param for auction over ---
 cfparam name=request.AppStatus default=
 
 
 
 !--- first we need to set the month parts we're dealing with ---
 cfset TodayMonth=#DatePart('m', Now())#
 cfset MonthEnd=#DatePart('m', #request.AuctionEnd#)#
 
 
 
 !--- now we test to make sure we haven't reached the final month of the
 auction ---
 CFIF NOT TodayMonth lt MonthEnd
 
 
 !--- if this is the final month, we need to set the day and hour parts
 ---
 cfset TodayDate=#DatePart('d', Now())#
 
 cfset TodayTime=#DateAdd('h', '-3', Now())#
 cfset TodayTime=#DatePart('h', TodayTime)#
 
 cfset DateEnd=#DatePart(d, #request.AppEnd#)#
 cfset TimeEnd=#DatePart(h, #request.AppEndTime#)#
 
 
 
 
 !--- if today's date is greater than or equal the end date, keep the
 processing going ---
 cfif TodayDate GTE DateEnd 
 
 !--- if the processing is going, check to see if the time has expired on
 hours ---
 cfif TodayTime GT TimeEnd 
 
   cfset request.AppStatus=Over
   
   cfelse
   !--- if the first test of the day passes, the time test will only
 be true from 9 p.m. to midnight; so after the date expired, we want to
 make
 it permenant that the App is over ---
   cfif TodayDate GT DateEnd 
   cfset request.AppStatus=Over
   /cfif
   
 /cfif
 
 /cfif
 
 
 /cfif
 
 
 
 
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Javascript Date Comparison

2001-07-06 Thread David Shadovitz

Create JS Date objects from the user input and then you can use the 
greater-than operator.

function validateDates(f) {
   var returnVal = true;
   var objStartDate = new Date(f.startDate.value);
   var objStopDate = new Date(f.stopDate.value);
   if (objStartDate  objStopDate) {
  alert('You cannot stop before you start!);
  returnVal = false;
   }
   return returnVal;
}

This assumes that the user-input dates are date strings, e.g. Aug 3, 1963. 
 Probably not too likely.  If the user-input dates are of the form dd/mm/yy or 
similar, you'll need to parse that into integers representing day, month, and 
year number (and know that the JS month is  0-based, i.e. December = 11).

You may want to back up your JS validation with server-side (CF) validation as 
well.

-David

On Friday, June 29, 2001 9:44 PM, Ali Awan [SMTP:[EMAIL PROTECTED]] wrote:
 I apologize for asking a non-cf question on here, but hey maybe there's a CF
 solution to it.
 I have a page where a user enters two dates in a form.  A Start Date and an
 End Date, I want to write a Javascript Validation function that compares the
 two dates to make sure that the End Date is not earlier than the Star Date.
 Does any one know of a good way to achieve this?

~~
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



OT: Javascript Date Comparison

2001-07-05 Thread Ali Awan

I apologize for asking a non-cf question on here, but hey maybe there's a CF
solution to it.
I have a page where a user enters two dates in a form.  A Start Date and an
End Date, I want to write a Javascript Validation function that compares the
two dates to make sure that the End Date is not earlier than the Star Date.
Does any one know of a good way to achieve this?

Thanks in advance,
Ali

~~
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



RE: SQL Server Date comparison

2000-06-23 Thread Philip Arnold - ASP

 Thanks Phillip and Robert.  The CreateODBCDateTime didn't work - 
 in debugger
 that turned the date into 6-22-00 00:00:00 so any documents I added today
 wouldn't be found.  I used Robert's syntax below and it worked 
 like a charm!
 Thanks MUCH!!!
 
 WHERE tblDocumentMstr.effectivedate Between
   #CreateODBCDate(form.begindate)# And
 DateAdd(d,1,#CreateODBCDate(form.enddate)#) 

Hey, looks miffed that was mine goes off in a huff

Philip Arnold
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. If you have received this email in error please notify 
the system manager.
**


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: SQL Server Date comparison

2000-06-23 Thread Smith, Melanie

Oops - Correction - Sorry Phillip!  Don't be miffed!  Thanks a lot

 -Original Message-
 From: Smith, Melanie 
 Sent: Thursday, June 22, 2000 5:27 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  RE: SQL Server Date comparison
 
 Message-ID: [EMAIL PROTECTED]
 
 Thanks Phillip and Robert.  The CreateODBCDateTime didn't work - in
 debugger that turned the date into 6-22-00 00:00:00 so any documents I
 added today wouldn't be found.  I used Robert's syntax below and it worked
 like a charm!  Thanks MUCH!!!
 
 WHERE tblDocumentMstr.effectivedate Between
   #CreateODBCDate(form.begindate)# And
 DateAdd(d,1,#CreateODBCDate(form.enddate)#) 
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



SQL Server Date comparison

2000-06-22 Thread Smith, Melanie

Hello All - hope someone can help me with a simple question.  When I try to
do a query based on user date range input, using = and = criterion, it
doesn't always recognize the "=" part. I'm thinking this has something to do
with the fact that SQL Server stores date/time instead of date only.  Does
anyone know the correct syntax to use in CF to have it always recognize the
"=" in a = comparison?

Here's my code:

SELECT  *
FROMtblDocumentMstr
WHERE   tblDocumentMstr.effectivedate =
#CreateODBCDate(form.begindate)#
AND tblDocumentMstr.effectivedate =
#CreateODBCDate(form.enddate)#

thanks!
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: SQL Server Date comparison

2000-06-22 Thread Robert Everland

change createodbcdate to createodbcdatetime and see what happens.

Robert Everland III
Web Developer
Dixon Ticonderoga


-Original Message-
From: Smith, Melanie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 22, 2000 11:44 AM
To: '[EMAIL PROTECTED]'
Subject: SQL Server Date comparison


Hello All - hope someone can help me with a simple question.  When I try to
do a query based on user date range input, using = and = criterion, it
doesn't always recognize the "=" part. I'm thinking this has something to do
with the fact that SQL Server stores date/time instead of date only.  Does
anyone know the correct syntax to use in CF to have it always recognize the
"=" in a = comparison?

Here's my code:

SELECT  *
FROMtblDocumentMstr
WHERE   tblDocumentMstr.effectivedate =
#CreateODBCDate(form.begindate)#
AND tblDocumentMstr.effectivedate =
#CreateODBCDate(form.enddate)#

thanks!

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: SQL Server Date comparison

2000-06-22 Thread Philip Arnold - ASP

 Hello All - hope someone can help me with a simple question.
 When I try to
 do a query based on user date range input, using = and = criterion, it
 doesn't always recognize the "=" part. I'm thinking this has
 something to do
 with the fact that SQL Server stores date/time instead of date only.  Does
 anyone know the correct syntax to use in CF to have it always
 recognize the
 "=" in a = comparison?

 Here's my code:

 SELECT  *
 FROMtblDocumentMstr
 WHERE   tblDocumentMstr.effectivedate =
 #CreateODBCDate(form.begindate)#
   AND tblDocumentMstr.effectivedate =
 #CreateODBCDate(form.enddate)#

Why use Between?

SELECT  *
FROMtblDocumentMstr
WHERE   tblDocumentMstr.effectivedate Between
#CreateODBCDate(form.begindate)# And #CreateODBCDate(form.enddate)#

One thing about this though, a CreateODBCDate will be midnight of that date,
so maybe the second date wants to be
DateAdd(d,1,#CreateODBCDate(form.enddate)#)

That's assuming that form.begindate and form.enddate are REAL date formats -
if they're just text, then you'll have to convert them anyways...

HTH

Philip Arnold
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: SQL Server Date comparison

2000-06-22 Thread Smith, Melanie

Message-ID: [EMAIL PROTECTED]

Thanks Phillip and Robert.  The CreateODBCDateTime didn't work - in debugger
that turned the date into 6-22-00 00:00:00 so any documents I added today
wouldn't be found.  I used Robert's syntax below and it worked like a charm!
Thanks MUCH!!!

WHERE tblDocumentMstr.effectivedate Between
#CreateODBCDate(form.begindate)# And
DateAdd(d,1,#CreateODBCDate(form.enddate)#) 
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.