|
-
September 28th, 2001, 07:47 AM
#1
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]
-
September 28th, 2001, 08:00 AM
#2
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
-
September 28th, 2001, 08:04 AM
#3
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]
-
September 28th, 2001, 08:30 AM
#4
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
-
September 28th, 2001, 08:57 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|