Sign in to follow this  
Followers 0
CheeseBiscuit

Can't create a file with current date

4 posts in this topic

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?

 

Share this post


Link to post
Share on other sites



Eh, you can't use "/" in a file name


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

*facedesk*

I knew it was something stupid.. Completely forgot, thanks :P

Share this post


Link to post
Share on other sites

The problem is the colons, but Im sure you got that by now.

Share this post


Link to post
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
Sign in to follow this  
Followers 0