Editing Date/Time Variables

You can edit the format for a custom variable to change how the system date and time are displayed. You can also add multiple alternate definitions to a variable, using them as a way to override variables on a target. For example, you might want to use different date/time variables for audiences in different time zones. You can associate multiple definitions with the same variable and use the appropriate one wherever necessary.

How to Edit a Date/Time Variable

  1. Open the Project Organizer.
  2. Double-click the Variables folder. Your variable sets are displayed.
  3. Double-click the custom variable set (such as MyVariables) that contains the variable you want to modify. The Variable Set Editor opens to the right, with the variables page shown.
  4. Click in the Definition cell for a date/time variable. The Edit Format dialog opens.
  5. In the field, enter a combination of format specifiers. As you do this, the current date and time are displayed below the field in that format.

    Specifiers are based on Microsoft's custom date and time format strings. For details of the specifiers available, see:

    Copy
    http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

    Here are some of the more common specifier combinations:

    Specifier Combination

    Result

    MMMM dd, yyyy hh:mm:ss tt

    July 09, 2013 03:55:53 PM

    hh:mm:ss tt dd MMMM, yyyy

    03:55:53 PM 09 July, 2013

    dddd MMMM dd, yyyy

    Tuesday July 09, 2013

    ddd MM/dd/yy

    Tue 07/09/13

    Note You can make a word part of the definition. For example, you might want the word Date with a colon and a space before a date string (e.g., Date: October 25, 2014). The issue is that certain characters are translated automatically as specifiers. So just typing the word Date wouldn't work. The easiest solution is to put the non-specifier characters within quotation marks. Therefore, you might enter "Date:" MMMM dd, yyyy.

  6. In the Update field, select how you want the variable to display the date and time. You can choose any of the following:

    • Manually The variable displays the date and time when the variable was created. You can update the variable manually, and it will display the date and time when it was most recently updated. See Updating Manual Date/Time Variables.
    • On File Creation The variable displays the date and time that you created the file.
    • On File Save The variable displays the date and time that you last saved the file.
    • On Project Save The variable displays the date and time that you last saved all the files in the project.
    • On Build The variable displays the date and time of the most recent project build. This is the default date/time variable type.

  7. Click OK. It might look something like this:

  8. Click Save the active file. to save your work.

How to Add Variable Definitions

  1. In the Project Organizer, double-click the Variables folder.
  2. Double-click a variable set. The Variable Set Editor opens.
  3. Click on a row where you want to provide an additional definition.
  4. In the local toolbar click . A new row is added for the new definition.
  5. In the empty cell that is added, type the definition and press ENTER. If you want to insert a variable in a field, you can click Insert Variable button. The variable will appear as syntax in the field, but in the output the variable definition will be shown.

    When a variable has multiple definitions, cells of the non-default definitions are grayed out (except for the definition cell).

    The default definition is determined by the order of creation. The first definition created is the default.

    The Variable Set Editor showing multiple definitions for a variable.

    Note If you want to see the variable syntax replaced by the variable definition, click Toggles between showing variable definition and syntax in the local toolbar of the editor. This shows you the "Evaluated Definition," which determines the actual text of the variable.

  6. Click Save the active file. to save your work.

What’s Noteworthy?

Note Like standard variables, you can override custom date/time variables in a target. See Overriding Variable Definitions in Targets.

Note When naming or editing a variable, you must enter a unique name.

Note If you want to change how variables look when they display in the XML Editor and in generated output files, you can edit the MadCap|variable style in the Stylesheet Editor. See Styled Variables.

Note You can add custom date/time variables to your template pages to show when each topic in your output was created. These variables will update as if they are part of the topic, so you do not need to add a variable to each individual topic in your output. See Inserting Custom Date/Time Variables Into Template Pages.

Note System variables use the language set in a tag, in the target, or at the project level. For example, you might have an English operating system, but in a Flare target you have French set as the language. If you insert a date/time variable, the day and month will display in French when you generate that target. Flare will also adjust the format of the variable if necessary (e.g., date first vs. month first).