Dates from an access database

Results 1 to 2 of 2

Thread: Dates from an access database

  1. #1
    Join Date
    Dec 1969

    Default Dates from an access database

    this is weird?! I have MS Access database which I query, retrive a record, present on a form to the user to amend and then make the amendment to the db.<BR><BR>one of these fields is a date field format dd/mm/yyyy, but it appears in the input box on my form as format dd/mm/yy I have validation on this on the form which is ensuring a 4 digit year so even if you don&#039t change the date field it will complain about it when you try and submit the amendment!..huh?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Dates from *ANY* source!

    Date values are *NOT* stored as strings. They are stored as funny numbers (number of seconds since some starting time, I believe).<BR><BR>This is true in *both* Access *and* VBScript (and JavaScript and VB and Java and C++, because Date is a fundamental data type).<BR><BR>So you get the funny-number-that-happens-to-be-a-date out of the database and move it into VBScript code in ASP. Then you ask VBS to disply that on the HTML screen. And VBS says "oh, he/she wants me to convert this funny-number-that-happens-to-be-a-date to a string for him! no problem, I&#039ll just use my ordinary rules for doing so and give him d/m/yy or whatever." (And, just incidentally, it could format it as mm/dd/yy or mm/dd/yyyy or whatever the "locale" setting on the server indicates that the default for your system is!)<BR><BR>SO... If you want it to be formatted on the screen as dd/mm/yyyy, then you will have to use the FormatDateTime function built into VBScript.<BR><BR><BR>

Posting Permissions

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