OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Date problem when date used as parameter in Hyperlink

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Date problem when date used as parameter in Hyperlink
Page: [1]
 
 
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
Date problem when date used as parameter in Hyperlink - 9/19/2003 12:27:53   
Hi,

I have a very simple DRW page, it lists all the records of a table.
That table has 2 fields. 1 field is a date.

Now i created a hyperlink to a detailspage from that date. Here the problem begins:

if the date is 01/01/2003 then everithing is ok.
if the date is 17/01/2003 then everithing is ok.

if the date is 01/02/2003 then it's not ok
On my deatailspage i then get ""No records returned.""

And i know that there should be a record with 01/02/2003 as date.
if that table has a record with as date 02/01/2003 then this record will be showed instead of the correct one: 01/02/2003

I've read alot,
CHanging LCID doesn't change a thing, it only changes the date format when displayed.

Anyone can tell me whats happening here?

tx
Jorge
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/19/2003 13:48:44   
Post your SQL query line.

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/19/2003 14:47:17   
Here it is:

s-sql="SELECT * FROM wedstrijde WHERE (Datum = #::Datum::# AND Naam = '::Naam::')"

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/19/2003 23:27:14   
Check this out:

http://sqlzoo.net/howto/xdatessqlserver.htm

If you can't find your solution here, repost.

:)

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 12:06:23   
The solution for all my date problems is this i think:
************************************************************
<%

Function MediumDate( ByVal stringToCheck, ByVal defaultOut )

Dim dayPart
Dim monthPart
Dim yearPart

If IsDate( stringToCheck ) Then

dayPart = Day( stringToCheck )
monthPart = Monthname( Month( stringToCheck ), True )
yearPart = Year( stringToCheck )

MediumDate = dayPart & "-" & monthPart & "-" & yearPart

Else

MediumDate = defaultOut

End If

End Function

%>
************************************************************
And here's an example of how to use it to get rid of your Date problems ....

**********************************************************************************************************
sql = "UPDATE tblOrders " _
& "SET fldDateOrdered = # " & MediumDate( Date(), "Null" ) & " # " _
& "WHERE fldStatus = open ;"
************************************************************
But i don't know the syntax to use this in my query:

s-sql="SELECT fldDateOrdered,productordered FROM tblOrders WHERE (fldDateOrdered = #::fldDateOrdered::#)"

i've got exactly the same problem as discribed over here:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20638920.html

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 20:02:28   
Did it work for you?

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 21:19:20   
No, i'm still searching for a solution.
This is really a hard one for me
the problem exist only when i use the date in a hyperlink to go to a page that has that date as criteria in the DRW

I know that I should add a Function, or use FormatDateTime or Format, or whatever, but at the moment i don't know anymore where to begin.
I'm to confused.

Access and ASP AND dates other then US format are hell for me

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 22:23:43   
To narrow down the problem, start at the beginning.

The first thing you have to do is check the date value coming in to your DRW page and make sure it is being transferred correctly from the hyperlink. If it's not coming in correctly, anything you try won't work.

Create a little ASP code right at the top of the DRW page and have it display the value being sent from that hyperlink.

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 22:34:53   
sorry, but how do i do that, ==> Create a little ASP code right at the top of the DRW page and have it display the value being sent from that hyperlink.

If fldDateOrdered is the value

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 1:49:28   
<%=request("fldDateOrdered")%>

OR...

<%
test = Request.form("fldDateOrdered")
response.write (test & "<BR>")
%>


OR...

<%
test = Request.QueryString("fldDateOrdered")
response.write (test & "<BR>")
%>

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 7:08:24   
If the date in the link i created from "fldDateOrdered" = 1/1/2003, then no problems
If the date is 21/04/2003, then no problems
But if the date is 01/04/2002, then my query doesn't know what are the days and what are the months

<%
test = Request.QueryString("fldDateOrdered")
response.write (test & "<BR>")
%>

This i putted on top of my details page, It gives me the correct value, the value that it should be.always, even when 1/04/2002 is the date.

(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 11:13:05   
I'm now trying to use that famous ISODATE function, but i can't get the right usage of it.

s-sql="SELECT * FROM tblOrders WHERE fldDateOrdered = #" & ISODate(Session("fldDateOrdered")) & "#" "


this is giving me a Syntax error in date in query expression 'fldDateOrdered = #'.

(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 11:33:23   
another detail:

When I putted
<%
test = Request.QueryString("fldDateOrdered")
response.write (test & "<BR>")
%>
on top of my detailspage then something strange happend.

then i saw the right date on top of the page, but the result from the query was incorrect(swapped days and months). So i assume that the problem is not the value given to the query, but the value that is coming out of the query

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 15:04:53   
Is your DRW dieted with a spooky diet?

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 15:07:49   
No it isn't, do you think that is going to change anything here, i mean the problem with the dates

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 15:37:19   
Well, it gives you more flexibility on how to attack any problem in a DRW.

Here is a list of all VB functions including all date functions (bottom left side of page). I'm thinking maybe DateValue.

http://www.devguru.com/Technologies/vbscript/quickref/vbscript_list.html

s-sql="SELECT * FROM tblOrders WHERE fldDateOrdered = DateValue(fldDateOrdered)"

_____________________________


(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 18:48:30   
I don't now it anymore now.
I created a page where you can see what's happening

http://pigeons.no-ip.info/tester30/time.Asp

Just click on the different dates en see the results

You'll see that 06/01/2004 is not working.

I need to reformat the date before it is given to the query. Can show me how to do that.

So the date that i have from the resultpage, that date is the date that i'm using in the hyperlink, i need to swap days and months before the query is send to the db.

I hope that i'm not to confusing here

(in reply to jorge)
jorge

 

Posts: 31
Joined: 9/8/2003
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 20:27:51   
I found it:::::

fp_sQry="SELECT FORMAT(wedstrijde.Datum,'mmm-dd-yyyy')As Datum,Naam FROM wedstrijde ORDER BY Datum DESC"

tx everybody

(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 20:29:28   
jorge,

I was looking over your very first and last posts and two things just occurred to me......

First Item:
In your first post you said:

if the date is 17/01/2003 then everithing is ok.

What date format is that?:
DAY/MONTH/YEAR ?

Are you in the USA???
If you are in the USA, your date format should be MONTH/DAY/YEAR.

Second Item:
I had the same problem with some of my sites. And this drove me crazy until I realized something. If I try to perfrom a search with a date that is ahead of the current date, VB errors on me.

In your last post you used this example: 06/01/2004

This is what made me realize that your doing the same thing I did years ago. Today's date is 9/20/2003. So then 06/01/2004 is AHEAD of today. This is why some of the dates won't work. Because any that are ahead of today will error.

LLLuneeeee:)

< Message edited by Long Island Lune -- 9/21/2003 11:55:31 PM >


_____________________________


(in reply to jorge)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 20:30:56   
You beat me to the post. I was writing my response the same time you were. You solved the problem? Does it work with dates ahead of today???? Maybe I can learn from you.

LLLuneeeee:)

_____________________________


(in reply to jorge)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Date problem when date used as parameter in Hyperlink
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts