CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2001
    Location
    New York, USA
    Posts
    169

    TimeStamp feature in an ASP page

    Here's the problem:

    I have created an ASP listener page that would save every incoming package into a file on the local IIS/Server with a generic name, but the files cannot have the same name because that would overwrite the preivous file. The code is in the ASP file - VBSript.


    'Here's the code:

    set xmlDoc = Server.CreateObject("MSXML.DOMDocument")
    xmlDoc.Save(Server.mappath("TEST.xml"))

    'I have tried to "TimeStamp" the file, but I kept getting error messages - it doesn't recognize "NOW":
    TimeStamp = Now()
    xmlDoc.Save(Server.mappath(TimeStamp & ".xml"))




    Any suggestions?

    THANKS!!!

    [email protected]

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: TimeStamp feature in an ASP page

    Hmm, normally Now should work in ASP/VBScript. Another thing that could be causing this problem is that now returns a date, which typically includes / in it. This could cause the save function to fail, because / is a path seperator on the web.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Aug 2001
    Location
    New York, USA
    Posts
    169

    Re: TimeStamp feature in an ASP page

    is there any other way to save the files with unique names? I guess TimeStamp doesn't work in this case.


    [email protected]

  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: TimeStamp feature in an ASP page

    Ok, this looks a bit messy (ok, it is a bit messy), it gets the different parts of the date, and adds timer (milliseconds since midnight)

    dim timestamp
    timestamp = datepart("yyyy",now)
    If len(datepart("m",now))=1 then timestamp = timestamp & "0"
    timestamp = timestamp & datepart("m",now)
    If len(datepart("d",now))=1 then timestamp = timestamp & "0"
    timestamp = timestamp & datepart("d",now)
    timestamp = timestamp & "-" & (Timer * 100)




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  5. #5
    Join Date
    Aug 2001
    Location
    New York, USA
    Posts
    169

    Re: TimeStamp feature in an ASP page

    Thanks much! It works very well!

    [email protected]

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured