Jump to content

Holdstrong

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Holdstrong

  1. That is a neat piece of code and I am glad you mention it. I learned about it while researching this problem and I have tucked it away for future use/reference. However, since the problem was not in the displaying of dates on the actual site, but was instead in the storing of dates in the Access database, it didn't help me with this particular problem.
  2. Great point. Thanks for talking me through this. I certainly have a much better handle of the problem now. Luckily for me, my user base is a know entity, and how they will enter the dates is also known. They will use US Standard. So this cuts me a break, so to speak. Instead of completely re-doing every page that asks them for a date so that they enter months, days, and years into separate boxes... I can just convert their entries to an unambiguous format and then send that along to the Db.Here was my solution.I run the following code at the top of my page:correctDate = day(request("mydate1")) & "-" & monthName(month(request("mydate1"))) & "-" & year(request("mydate1"))correctEnddate = day(request("enddate")) & "-" & monthName(month(request("enddate"))) & "-" & year(request("enddate")) And then, change this: objrs.fields("date") = request.form("mydate1")objrs.fields("end_date") = request.form("enddate") To this: objrs.fields("date") = correctDateobjrs.fields("end_date") = correctEnddate And bam, I am not converting the US Standard mm/dd/yyyy that my users enter to the semi-unambiguous dd/mmm/yyyy and sending THAT along to my Db instead. The Db is accepting it correctly and stores and then displays it correctly.
  3. Thanks for the continued input, I really do appreciate it.Now, correct my thinking again if it is wrong... but I just made the following test page on my server:Date Test PageThat page is a close mirror to the actual page I am working on. It is modified so that when you enter a date in US format, or in an unambiguous format such as yyyy/mm/dd, it will attempt to convert it to the unambiguous format d/mmm/yyyy and display it at the top of the page.Seems to work. Now doesn't this show that the page itself is actually translated dates correctly? Or at the very least, doesn't it show that we can convert user entered strings to an unambiguous format?If the latter is true, then shouldn't it just be a case of passing the converted date to the database instead of the raw string originally entered by the user?
  4. Yeah that would certainly be a solution, unfortunately that would require some serious rewrites of quite a few pages... and given my abilities (or lack there of) I am going to save that for dead last.If there was some way I could run a conversion on the form input before sending it off to the database that would seem to solve the issue. Just unsure of how to do it. Possibly by linking a function to the OnSubmit part of the form so that when the user clicks submit a function runs that converts "mydate1" and "enddate" to unambiguous formats first and then returns true to send off to the db?
  5. Thanks for the reply and great info!So, since my first post I have done the following test... If I insert an unambiguous date, such as 7-feb-2007 (dd/mmm/yyyy) or 2007/2/7 (yyyy/mm/dd) Access does receive and store the info correctly.Seems pretty clear we are dealing with a regional settings info somewhere between the ASP page and that Access Db. However, this site is hosted by a third party and I have no access to these machines. I am in contact with them about the problem and they are looking into it, but I am not holding my breath that they will either find the problem, or correct it.However, it looks like one option would be to force people to insert the date in an unambiguous format... but, as we all know, relying on your users to do something, especially something which will feel foreign to them, is unlikely to produce happy results. However, what if there was a way for me to take the values they enter in those forms and force a format change behind the scenes BEFORE it gets passed to Access?In other words, my user enters 2/7/2007 in my form. That value is saved as "mydate1" via simple form HTML: <input type=text name="mydate1" size=12 class="9pxTextCopy"> and then is passed along to he database as is via: objrs.fields("mydate1") = request.form("mydate1") But what if before passing along to the database I converted "mydate1" somehow... maybe using FormatDateTime()??Here is where my extreme noobness will shine. I have no idea how I would take a value from a Form ("mydate1") and run it through something like FormateDateTime before sending it off to the Db.
  6. Hi everyone! Loooooong time browser, first time problem poster!I have an ASP page that has been active and functional for almost 4 years. It is hosted by a third party company and just recently they brought us down to do some hardware upgrades.Upon coming back up I noticed a rather odd problem...The dates that my page is capturing from a user form are being stored incorrectly in our Access Db. 2/7/2007 will be stored as 7/2/2007 and vice versa.However, 2/13/2007 will be correctly stored as 2/13/2007. I have since learned that what is most likely going on here is that Access is suddenly (because of the upgrades?) storing dates in the UK standard dd/mm/yyyy instead of the US standard mm/dd/yyyy. The reason it correctly stores dates with "days" 13 and above is because it recognizes that 13 can not be a month and assumes user error and corrects it.So here is my problem. I need these dates to be stored as they are being passed... mm/dd/yyyy (I have confirmed they are being passed correctly still by sending them to a test TEXT field in which they arrive unaltered). Is there anyway, short of what I am sure will be the fruitless pursuit of asking my host to fix the problem on their end, to FORCE Access to just accept the darn date the way it is receiving it?
×
×
  • Create New...