Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > ASP and ASP.NET
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 05-14-2008, 08:39 AM
  #1
guy_norton
Novice (Level 1)
 
Join Date: Apr 2008
Posts: 3
iTrader: (0)
guy_norton is an unknown quantity at this point
ASP date comparison

Hi,

I have designed a calendar web app.

I pull info from a database when the date in the database table matches the comparison date:

if rs("dt") = d_date then bln_show_info = true else bln_show_info = false

"dt" is stored as (smalldatetime, 4) in SQL SERVER 2000
d_date is defined with : d_date = date (increments by 1 each time the code loops)

This is all very simple, and it worked perfectly until today, when for no reason I can see, it stopped matching 'dt' with 'd_date'.

If I list both variables side by side I see that, for example
'dt' =11/8/2008 5:49:00 AM d_date = 11/8/2008 does not result in a match.
This is presumably because the hours, seconds and minutes in 'dt' mean that 'dt' is seen as being greater than d_date. It didn't do this before, so why now!?

I have got round the problem by entering dates into the 'dt' with rs("dt") = FormatDateTime(d_Date, 2). Now 'dt' and 'd_date' match.

My question is can anyone tell me why the dates stopped matching? I honestly didn't change a thing. The version on the live server using the old code, and the old date formats does match the two variables (by ignoring the h/m/s)!


regards, Guy
guy_norton is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 04:13 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.