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 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy How do you write a date to a text file?

    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

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi,

    show us what you have this far..

    Tom

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    Look at the FileSystemObject and the Date() function.

    Code:
    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.


  •  

    Posting Permissions

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