Insert File Name and Date/Time Macro - formatting is odd

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
Arthur
Posts: 22
Joined: Fri Jan 13, 2012 3:50 am

Insert File Name and Date/Time Macro - formatting is odd

Post by Arthur »

If one in North America uses the "Insert Filename and Date/Time" macro he/she would get say

File Name: D:\Documents and Settings\arthur\My Documents\ProjectXYZ\FTP_Files.bat
Date/Time: 18 January 2012 15:19 PM

1st: Date/Time it has the / which bears a special meaning in most prog languages.
2nd: 18 January 2012 15:19 PM is not a correct format.
In North America this needs to be

January 18 2012 03:19 PM

I suggest to abbreviate the month to to Jan. 18 2012 3:19 PM. Perhaps PC locale needs to be used here?

3rd: So why do I get the complete path? Well, the name of the macro I would like: "Insert File Name and Date" and it would give me -
File: FTP_Files.bat Date: Jan. 18 2012 03:19 PM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

"Insert Filename and Date/Time" macro
This menu runs the file_date.lua macro. To see the macro code use the Macros, Load menu, select the file_date.lua macro and then use the Macros, View Source menu.
1st: Date/Time it has the / which bears a special meaning in most prog languages.
Since this information is generated by a macro it is fully configurable ;)
2nd: 18 January 2012 15:19 PM is not a correct format.
The macro formats the date an time using these Windows formatting patterns:

Code: Select all

local current_date = macro_tag("$DT<d MMMM yyyy> ")
local current_time = macro_tag("$T<HH:mm tt> ")
I suspect the format you want might be this:

Code: Select all

local current_date = macro_tag("$DT<MMM dd yyyy> ")
local current_time = macro_tag("$T<hh:mm tt> ")
But the format is fully configurable since any of these date/time strings should work: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
3rd: So why do I get the complete path?
The macro format formats the file name using this code:

Code: Select all

-- get file details using macro tags (see online help for more details)
local filename = macro_tag("$FN")
To have only the short file name appear change it to this:

Code: Select all

-- get file details using macro tags (see online help for more details)
local filename = macro_tag("$F")
Cheers Jussi
Post Reply