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 May 17th, 2003, 08:21 AM
lovelyeyes lovelyeyes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 10 lovelyeyes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help regarding date functions

Hi!!

I have some problem regarding the date functions. The problem I have is, I havea column in my SQL server database table by name request_generated_date of datetime datattype and the default value set to it the server date by using the function getdate().
I am querying this table wherein I want to check that when a user submits a form then it should check the following: the submit date (column:request_generated_date in the tabel)should be less than the server date + 24 hours (or one day). When I am writing the query as

where request_generated_date ='"&dateadd('d',1,date())&"'"

but the result set is empty.

Can somebody please help in this matter. Can I use the date() function in ASP or not. or should I try to remove the time factor from the server date and then query the column..I am confused.

Please help.

Thanks.

Reply With Quote
  #2  
Old May 19th, 2003, 02:44 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
This is the output I get from
Code:
Select getdate();


2003-05-19 17:41:21.827

You probably have to trim off the hr:mins:sec.mmm
unless you get an exact match the query will return nothing because the date actually retuns date and time.

Try using < or > or between, convert, datepart, and datediff.
With a combination of the above you should be able to get an answer
__________________
--

ngibsonau

Reply With Quote
  #3  
Old May 20th, 2003, 03:11 PM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
if you are using my sql as backend i would suggest you to convert the date in mysql's format before saving it
here is the example

sdate = Year(Date()) & "-" & Month(Date()) & "-" &Day(Date())
then save the sdate

bcoz mysql stores the date in yyyy-mm-dd format and asp send mm/dd/yyyy which is not compatible with mysql

rahul
__________________
Rahul

Small things lead to perfection and perfection is not a small thing.

Reply With Quote
  #4  
Old May 20th, 2003, 03:18 PM
lovelyeyes lovelyeyes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 10 lovelyeyes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
can you please send me the code as to how it could be done. I am lost totally...

Reply With Quote
  #5  
Old May 20th, 2003, 04:47 PM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
first try this
instead of using getdate() use curdate()
hopefully it will resolve the issue if not mail me again i will try to sort it out
Rahul

Reply With Quote
  #6  
Old May 21st, 2003, 06:15 AM
lovelyeyes lovelyeyes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 10 lovelyeyes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi!!! Rahul,

Thanks for the suggestion.

But I am using MS SQL Server as my backend. The problem is when I am going to set the datatype for the column I can do it as Curdate(), but when I try to query, I have to use the Date() function which again returns the date and time. How can I remove the time function from the date().

Thanks.

Reply With Quote
  #7  
Old May 21st, 2003, 01:01 PM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Hi lovelyeyes (at least put your name in the profile it will help someone to address you)

In your first respone you wrote that you are using MySQL and in the previous one your are saying that you are using MS SQL Server. plz clear this thing bcoz every backend is having its own date format the resolution i have provided you was for MySQL Server.

in asp date() returns only date, time() returns only time, and now() returns both

respond me so that i can assist you
Rahul

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Help regarding date functions


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 2 hosted by Hostway