How to insert the date in a specified format with a macro?

How to insert the date in a specified format with a macro?

2
NewbieNewbie
2

    Mar 12, 2009#1

    Hi,

    new to macros. Love UltraEdit.
    What I want to do is at the end of this macro I want to put a string of today's data in this format: _2009-03-12-11-03AM.txt

    The macro won't compile due to the last line. It appears I cannot interpret the code sample in the manual correctly.
    Any healp would be greatly appreciated.

    TIA

    Allan

    InsertLine
    "/* ====================================== */"
    InsertLine
    "/* NAME : "
    CopyFilePath
    Paste
    " */"
    InsertLine
    "/* PROJECT : xxxx */"
    InsertLine
    "/* AUTHOR : AllanB */"
    InsertLine
    "/* LAST MOD : "
    TimeDate
    " */"
    InsertLine
    "/* ====================================== */"
    InsertLine
    InsertLine
    InsertLine
    [DATE_USER_SYS]'_'yyyy'-'mm'-'dd'-'hh'-'mmtt[DATE_USER_SYS_END]

    6,686585
    Grand MasterGrand Master
    6,686585

      Mar 12, 2009#2

      You can't use a template definition in a macro. You have to create a template and call this from within the macro. For example I have 2 templates:

      Template 0 is named "Date German" and has the template code [DATE_USER]dd'.'MM'.'yyyy[DATE_USER_END]

      Template 1 is named "Date International" and has the template code [DATE_USER]yyyy'-'MM'-'dd[DATE_USER_END]

      In a macro which is written for updating dates in HTML files I use the macro commands Template 0 and Template 1.


      A second variant is to use the macro command TimeDate to insert date and time as defined in the Windows regional and language settings and reformat it with a regular expression search and replace. I don't like this method because it depends on the date and time format defined in the regional and language settings of Windows. So I don't have control how the inserted date and time looks like. But this variant has the advantage that it does not depend on the currently loaded templates.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Mar 12, 2009#3

        Thanks for you help

        Allan