Jump to content
  • 0
DesiLogi

Add Date to String in Formula

Question

Does anyone know how to add a Date field's value into a text string, in a formula, where the other fields are text? The two different data types won't work together in the same formula and I need to add a date field's value to the end of a string of other fields. Thanks for the help-

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
On 12/21/2017 at 4:57 PM, Vitalikssssss said:

LEFT(CONVERT(VARCHAR, [@field:Date], 120), 10)

@Vitalikssssss this is SO helpful!! Thanks very much! At first I deleted the "left" and "10" because I didn't understand their purpose, but now I get it :) For anyone wondering, here's an explanation for why it's useful:

The "LEFT" at the start of the formula gives instruction to only keep the left side of whatever is contained in the brackets that follow, and the "10" gives instruction to keep the first 10 characters (to the left, in this case; you can also use "right" in other cases). So you have year (4 characters), plus month (2 characters) plus day (2 characters) plus 2 forward slashes: ex. "2018/03/22", and that's a total of 10 characters. If you didn't limit the date to 10 characters, the time would be included as well.

In case anyone wants the time included in the date-turned-string, just remove the "LEFT("   and the   ",10)from Vitalikssssss's answer above. And if you want only the time, use "right" instead of "left" and replace 10 with the number of time characters (don't forget to include ":" as part of your character count).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×