...

View Full Version : How do you write a date to a text file?



ammwebmaster2@a
01-09-2008, 07:55 PM
I am writing data to a text file but don't know what script to use to pass a date to the text file. Any help would be greatly appreciated.

Thanks:D

Whatever Jr.
01-10-2008, 11:37 AM
Hi,

show us what you have this far..

Tom

ghell
01-12-2008, 07:31 PM
Look at the FileSystemObject (http://www.w3schools.com/asp/asp_ref_filesystem.asp) and the Date() function.


Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set textStream = fso.OpenTextFile(Server.MapPath("file.txt"), 2, True)
textStream.WriteLine(Date())
Call textStream.Close()
Set textStream = Nothing
Set fso = Nothing

You must have write permissions on the directory in order to do this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum