Convert Date Time To Text Step

 

he Convert Date Time To Text step changes a date and time variable into a text string. You can set the exact format of the output text. Use this step when you need to show a date or time in a certain way, or when you need to send date information as text to another system.

How to Use Convert Date Time To Text

This step turns a datetime variable into a string variable.

Step 1: Add the Step

  1. Drag the Convert Date Time To Text step into your process.
  2. (Optional) Give the step a custom name in the Step name field.

Step 2: Set Up Input Parameters

  1. Source datetime variable (Required)
    • Type the name of an existing datetime variable. This is the date and time you want to change.
  2. Date format (Required)
    • Type the format you want for the output text.
    • Example: dd.MM.yyyy will make a date look like 21.03.2023.
    • You can use standard or custom formats.

Step 3: Set Up Output Parameters

  1. Destination text variable (Required)
    • Type a name for the new string variable that will hold the converted date and time.
    • You can also pick an existing string variable to update its value.

Parameters Explained

Step name (Optional)

  • A custom name for this step in your process.

Source datetime variable (Required)

  • The datetime variable you want to change.
  • Example: myDateTimeVariable
  • When to use it: Always provide the datetime variable that has the original date and time.

Date format (Required)

  • Shows how the datetime value will look as text.
  • Example: MM/dd/yyyy HH:mm:ss for 03/21/2023 14:30:00
  • When to use it: Tell it the exact format you need for the output string.

Destination text variable (Required)

  • The string variable where the changed date and time will be saved.
  • Example: formattedDateString
  • When to use it: Always provide a variable name to hold the result.

Important Things to Know About Date Formats

When you use a custom format, be careful with characters that have a special meaning in date formatting. These characters will be replaced by their date or time values, even if they are part of your custom text.

Example:

  • If you use the format "day: d"
  • The output might look like "21a25: 21"
  • This happens because d means day, and y means a short year. The y in "day" is read as part of the date format.

Additional comment

You can use either standard or custom formats to convert dates, times, or parts of them.

 

When using a custom format, you can integrate it with other text, but you need to be cautious. Each character that holds a specific meaning will be replaced by the corresponding value of the date or time. For example, in the format "day: d" the output might appear as "21a25: 21" because "d" stands for day and "y" stands for short year. Even within your custom text, these characters will be substituted with their respective date values.

Related Articles

Need Help?

Can't find what you're looking for? Join the Robotiq Community to get help from other users and the Robotiq team.

Was this article helpful?