Jump to content

Can't create a file with current date


Recommended Posts

For the life of me I can't seem to get the current date + time + log.txt to work when I try to create a file..

I just want the created file to be named "mm/dd/yyyy-hr:mm:seconds-log.txt

This is my code:

$_filename = @MON & "/" & @MDAY & "/" & @YEAR & "-" & @HOUR & ":" & @MIN & ":" & @SEC & "-log.txt"
;MsgBox(1, "date", $_filename)
$_file = FileOpen($_filename, 2)
If $_file == -1 Then
    MsgBox(4096, "Critical Error", "Couldn't Create Log File!")
    exit
Endif

I first tried _Now() and _NowDate() and _NowTime(), They all set the variable to the date and time + log.txt but when I try to create the file it throws the error msg EVERYTIME!!!

 

Where is my error?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...