Please help with a serious date format dilemma!

Results 1 to 3 of 3

Thread: Please help with a serious date format dilemma!

  1. #1
    Shannon Shiflett Guest

    Default Please help with a serious date format dilemma!

    Hello! I&#039m reading a date field in from an Access database. I need the date to be in the format of MM/DD/YYYY (zero-fill and 4-digit year), because I&#039m parsing the date into three separate fields in a page where the user can edit the date. However, the date format appears to be random. I know it&#039s associated with the short date format specified in Regional Settings in the profile of the user that is currently logged onto the server; although, my problem is that when no one is logged onto the server, the date format seems to change randomly from MM/DD/YYYY to M/D/YY, which I can&#039t use. Can someone either tell me how to make sure the date format on the server is consistent, even when no one is logged onto it, or tell me how to use some ASP/VBScript code to take a date variable and convert it to the format I need? I&#039d really appreciate it. You can either reply here or e-mail me directly at Thanks so much in advance!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Please help with a serious date format dilemma!

    It doesn&#039t matter what format the date is in, you can grab the info you need using some date functions.<BR><BR>Dim currentDate<BR><BR>&#039Set the currentDate to today&#039s date:<BR>currentDate = Date<BR><BR>&#039Use Month, Year, and Day<BR>Dim currentDay, currentMonth, currentYear<BR>currentDay = Day(currentDate)<BR>currentMonth = Month(currentMonth)<BR>currentYear = Year(currentYear)<BR><BR>See the following URLs for technical explanations of these functions:<BR><BR><BR><BR><BR><BR>Happy Programming!

  3. #3
    Shannon Shiflett Guest

    Default RE: Please help with a serious date format dilemma!

    Thnanks so very much, Scott. That really did the trick. Although, I had to modify it a little bit because the Year() function returns a 4-digit year; however, the Day() and Month() functions don&#039t do the zero-fill (so Jan. would be 1, not 01), but I added some code to test the length of the string and add the zero, if necessary. Anyway, you put me on the right track, and now I can continue with my project. I really appreciate your assistance!

Posting Permissions

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