ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old April 1st, 2003, 03:14 AM
monfu monfu is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Dublin
Posts: 40 monfu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 25 sec
Reputation Power: 6
working with Dates

Dear All,

I am having a lot of problems working with dates:-

First of all I have a table called articles, and I have a date field, which is in text format, and I insert the dates for example 02/11/2003 in it. Now the user can enter articles that are bigger than todays date, however I want to display only those that are smaller than todays date. Is it possible to convert the text field I have for dates into numeric format? And if so, will the comparison work? At the moment it is not working since for the database, 11/02/2000 is bigger than 01/04/2003. Another thing, I wish to keep the Articles dates in text format for my purposes.

My second problem is when coming to compare dates:-

I have this sql statement
sql = sql & " AND newsArticles.newsDate BETWEEN " & "'" & FromDate & "'" & "AND '" & ToDate & "'"

but it is not working properly. This is the result when I write the sql with a response.write:-

select newsArticles.newsID, newsArticles.newsMainSecID, newsArticles.categoryID, newsArticles.newsDay, newsArticles.newsMonth, newsArticles.newsYear,newsArticles.newsDate, newsArticles.newsTitle, newsArticles.newsAuthor, newsArticles.newsSummary, newsArticles.newsText,newsCategory.categoryName, newsMainSec.newsMainSecName from (newsArticles INNER JOIN newsCategory ON newsArticles.categoryID = newsCategory.categoryID) INNER JOIN newsMainSec ON newsArticles.newsMainSecID = newsMainSec.newsMainSecID WHERE newsArticles.newsMainSecID = 1 AND newsArticles.newsDate BETWEEN '01/01/2000'AND '01/04/2002' ORDER BY newsArticles.newsDate Desc

and it is not returning any results when there should be. What am I doing wrong?

Your help is very much appreciated!

Reply With Quote
  #2  
Old April 7th, 2003, 07:51 AM
Illuvatar Illuvatar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 9 Illuvatar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Why don't you just use a date field of the DATE type? Ms Access has a Date/Time field and (My)SQL has a date field of the YYYY-MM-DD format.
All you have to do (once you have a proper date field) is convert your date to the current format.

Reply With Quote
  #3  
Old April 12th, 2003, 03:07 AM
ngibsonau ngibsonau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 138 ngibsonau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Just to state obvious you could use datediff or dateadd functions
__________________
--

ngibsonau

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > working with Dates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway