Reputation: 438
I extract a timestamp from a regex. This will be in the raw format: YYYYMMDD
There isn't a timestamp, from the documentation, that seems to be acceptable. I tried with and without.
I just want to convert it to MMMDD
however, it just outputs today's date in everything that I've tried. So I must be missing something major.
regexmatch(file_name, "O) (202[0-9][0]?[1]?\d{1}\d{2})", diag_date)
; diag_date[1] in all my testing has been 20200831
msgbox % "Unformatted Date: " diag_date[1]
FormatTime, diag_date, diag_date[1], MMMdd
msgbox % "Formatted Date: " diag_date
--Simpler test--
unformatted := "20200831"
FormatTime, formatted, unformatted, MMMdd
msgbox % formatted
; still outputs today's date.
The last msgbox keeps returning today's date even though the matched date is another date (e.g. 20200831)
Upvotes: 1
Views: 315
Reputation: 6489
You're not forcing an expression on the second parameter. So it just interprets you passing in an invalid timestamp.
unformatted := "20200831"
FormatTime, formatted, % unformatted, MMMdd
msgbox % formatted
Upvotes: 2