|
Macro Express allows you to include dates and times in your macros. With the Date/Time macro command your macro can type a date or time directly into a program and put
the date and time into either a string or date/time variable. This command is very flexible. With it you can include all or part of the date with long and short formats
and all or part of the time in either 24 hour format or am/pm format.
The Date/Time command, included in both Macro Express and Macro Express Pro, replaces the separate and less capable Date and Time commands in Macro Express 3. When a macro is
loaded into Macro Express Pro all Date and Time commands are automatically converted to use the Date/Time command.
Recent questions to our support people about the Date/Time command indicate that many do not understand how powerful and flexible this command is.
On the Date/Time dialog, under the Operation tab, the 'Choose a Date/Time Format' field allows you to choose a specific format. Some of the choices are:
| |
Use this
|
To display this |
|
| |
dddd, MMMM dd, yyyy
|
Wednesday, April 20, 2010
|
Long day of week and Long Month format defined in Windows
|
| |
M/d/yyyy
|
4/9/2010
|
No leading zeros
|
| |
hh'.'nn'.'ss
|
22.09.15
|
Hour, minute, second
|
| |
hh','nn','ss am/pm
|
10,11,16 pm
|
12 hour format with am or pm
|
But, did you know you can define your own format? One that is not listed? The format can even include text characters. It can include
parts of the date such as year, month, day in both numeric format and words in your language. Parts of time from hours down to
milliseconds can be included. Times can be represented in 24 hour format or 12 hour format. Use the date and time separator characters
defined in Windows or specify your own. In short, you would find it hard to think of a date or time format that the Date/Time
command cannot support.
Here are a few examples:
| |
Use this
|
To display this |
|
| |
yyyy'.'mm'.'dd'.'hh'.'nn'.'ss'.'zzz
|
2010.04.20.14.37.53.429
|
Year, month,day, hour, minute, second, millisecond
|
| |
dd/mm/yy
|
4/19/2010
|
Uses the date separator defined in Windows
|
| |
'~bak'mmddyyyy
|
~bak04192010
|
Include the date when backing up a file
|
| |
'['yyyymmmdd']'
|
[2010Apr19]
|
Special characters make the date stand out
|
| |
ss' sec' 'zzz' ms'
|
53 sec 429 ms
|
Seconds and milliseconds
|
| |
mmmm' 'dd', 'yyyy
|
April 20, 2010
|
Long month format defined in Windows
|
| |
mmm 'dd', 'yyyy
|
Sep 23, 2010
|
Short month format defined in Windows
|
A complete list of these options is available in the Date/Time Modifiers section of the help file.
|
|
The longer your macro, the harder it becomes to read and understand. Comments not only describe what the macro is doing but can help
by making it easier to read. But comments only go so far.
Macro Express Pro introduces another way to highlight sections of your macro. You can set the color and background of script
commands by highlighting one or more commands, right-clicking, and choosing Set Text Color or Set Background color.
|