Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Between dates.... a strange behave
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Between dates.... a strange behave

 Post Reply Post Reply
Author
exepm2 View Drop Down
Newbie
Newbie


Joined: 30 June 2003
Location: Argentina
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote exepm2 Quote  Post ReplyReply Direct Link To This Post Topic: Between dates.... a strange behave
    Posted: 30 June 2003 at 12:24pm

Hi there, I've a nice sql, like this:

SELECT * FROM registro where status like '0' and pretendida between #01/06/2003# and #30/06/2003# order by pretendida desc

pretendida means expected, it`s a date format field in the mdb,  the problem is that I get many rows from the mdb and some outsite the range of the dates.

I tried LCID codes but it's all on its right way to dd/mm/yyyy.

so now what?

Back to Top
faubo View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
Post Options Post Options   Thanks (0) Thanks(0)   Quote faubo Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2003 at 2:28pm

I had this problem with Access.

I just change the LCID to US code before the query and change back to the brazilian to show the right format for my users.

It's working perfectly.



Edited by faubo
Back to Top
exepm2 View Drop Down
Newbie
Newbie


Joined: 30 June 2003
Location: Argentina
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote exepm2 Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2003 at 6:08am

Thank you very much faubo, but it didn't work in my asp.
Finally I found a good answer at www.4guysfromrolla.com

I had to change my dates without LCID, I had to made a Function that change the month xx/06/xxxx to xx-jun-xxxx, in that way it works with mdb files because they store dates in its particular way of counting day y time since 30-dec-1899.

<%

Function MediumDate (str)

DIM aDay

DIM aMonth

DIM aYear

aDay=Day(str)

aMonth=Monthname(Month(str),true)

aYear=Year(str)

Mediumdate= aDay & "-" & aMonth & "-" & aYear

END Function

%>

<%

Dim SqlJunk,a1,a2

Set dbGlobalWeb = Server.CreateObject("ADODB.Connection")

if request.form("donde")="instalaciones" then

dbGlobalWeb.Open("instalaciones")

end if

a1 = request.form("fecha1")

a2 = request.form("fecha2")

 

SqlJunk = "SELECT * FROM registro where status like '0' and pretendida "

 

sqljunk = sqljunk & " between #"

sqljunk = sqljunk & mediumdate(request.form("fecha1"))

sqljunk = sqljunk & "# and #"

sqljunk = sqljunk & mediumdate(request.form("fecha2"))

sqljunk = sqljunk & "# order by pretendida desc "



Edited by exepm2
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.