Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question All Digits of Date Needed For: Response.Write Date

    If I want to output the current date of 02/04/2003 and use "Date" as the command it will output 2/4/2003.

    Is there a way to force for the fully qualified date?

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    FormatDatetTime() or DateSerial() ought to cover however you need to format it.

    http://msdn.microsoft.com/library/de...ifunctions.asp

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Same Result

    The leading zeroes are always parsed... ;(

    The only thing that I can think of doing is writing an elaborate function to fill them in based on the position and month number...

    Any other suggestions?

    Thanks in advance!

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    try changing the date format in the Regional Settings properties of the server.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can always split it up...

    mydatearray = Split("2/4/2003","/")
    mynewdate = Right("00" & mydatearray(0),2) & "/" & Right("00" & mydatearray(1),2) & "/" & mydatearray(2)

    That will stick the correct number of leading zeroes in there (in this case, filling up 2 places).

    I often use code like this to format export script which will be sent to a client's AS/400 database which requires leading zeroes, since it eliminates the need for any elaborate function such as you mentioned.
    Last edited by whammy; 02-05-2003 at 06:35 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Thanks! Whammy You Never Cease To Amaze Me!!

    Thanks!

    It did work but upon refresh this is the error message:

    Error Type:
    Microsoft VBScript runtime (0x800A000A)
    This array is fixed or temporarily locked
    file.asp, line 216

    Can someone tell me the best method to avoid this error?

    Thanks!

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, I'm not sure what's causing that, that's a totally new error on me!

    Perhaps it's the variable you're splitting. Perhaps assign that string to another temporary variable?!?

    mytempdate = "2/4/2003"
    mydatearray = Split(mytempdate,"/")
    mynewdate = Right("00" & mydatearray(0),2) & "/" & Right("00" & mydatearray(1),2) & "/" & mydatearray(2)
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #8
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Thanks for always helping out....Again Whammy...Thanks!

    That was all that it took to solve the problem.

    For what ever reason I would get type mismatch when I tried before; however it now works and it is an excellent solution to what I was after rather than creating an awefully ugly function/sub!!!


    Thanks!


  •  

    Posting Permissions

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