Results 1 to 15 of 15
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Date formats (ASP)

    This is probably not the forum, i would appreciate where i could be directed to to find the answer.

    How are the formats defined in ASP forms?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Date formats (ASP)

    Forms presented in the browser, right?

    Are you using ASP.Net with Visual Studio, or ASP Classic with your choice of editors? Actually, in either case I'd guess JavaScript, as that is more cross-platform than ActiveX.

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date formats (ASP)

    It's been a while since I've used ASP, but this link should hopefully do the trick...

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    It is operated in IE.

    As to what they (a client) are using, i don't know at this stage.

    The backend database is Access and it had a format for the dates as mm/dd/yyyy, i changed them to nothing so it picks up the Control panel's dtate formats, this has worked quite well.

    My problem now is after changing the Access database for these date formats i cannot add a record using ASP.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    Thanks for your input, i have noticed that some ASP code does input using US date format.

    I don't know how to code in ASP so i have gone back to the client saying i cannot help.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Date formats (ASP)

    I think you need to write code for this, as there is no such thing an an HTML date field. What is posted by an HTML <input type="text"> field is just a string. That "date" string might contain 3/1/07 or 31/99/4567 or pestilence. You can use JavaScript in the page to try to coax the user into providing valid input, but your ASP script will need to determine whether the input is a valid date and, if so, whether it is within an acceptable range, before trying to write to the database.

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    Thanks Jefferson.

    I need to get a reference for ASP to work out how to do this.

    Do you know of any good ASP documents to read up on?

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Date formats (ASP)

    The ASP books I've bought have mostly been a bust, except for quick reference guides like ASP in a Nutshell. There are numerous ASP sites, and although many have switched to covering ASP.Net, there is plenty of old ASP content out there on the web. Also, your VBA resources should help, because very similar tools are available (the most critical omission might be the user defined date formats, but you can roll your own by extracting the individual elements, month, day, year, etc.).

  9. #9
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Date formats (ASP)

    Hi Pat

    I think you need a function, something like this:

    <pre>function gb_SQLDATE(d) ' make "#day/month/year#" from date
    dim strYear,strMonth,strDay
    strYear = CStr(Year(d))
    strMonth = CStr(Month(d))
    if Month(d) < 10 then
    strMonth = "0" & strMonth
    end if
    strDay = CStr(Day(d))
    if Day(d) < 10 then
    strDay = "0" & strDay
    end if
    SQLDATE="#" & strDay & "/" & strMonth & "/" & strYear & "#"
    end function
    </pre>

    You will want to play with code to get it to work but you could use it as an include to your main form
    Jerry

  10. #10
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    Depending on what the clients to do (i am trying to persuade them into using Access instead of ASP) will determine if i continue down the ASP reference purchase path.

  11. #11
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    Thanks Jerry, but i'm not sure what the client wants to do going forward in time.

    When you make a change to an .asp file, do you just use notepad to change the file then test the code using IE? Or are there special tools to change and test .asp programs?

  12. #12
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Date formats (ASP)

    I use Notepad/Textpad/EditPlus depending which PC/Laptop/Server I am on. I then dump it in a virtual directory and test in my browser, so yes.
    Jerry

  13. #13
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    Thank you.

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Date formats (ASP)

    As an aside, .asp doesn't run in a browser just from the hard drive. You definitely need an instance of Microsoft IIS in order to see how the ASP page will be interpreted.

    (From personal experience, it is very bad to create a loop through a RecordSet without having rs.MoveNext anywhere in the loop. <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15> )

  15. #15
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date formats (ASP)

    Thanks for that.

    ha ha about the rs.MoveNext, also make sure it is executed and not just in the loop.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •