Jump to content
  • 0

Add Date to String in Formula


DesiLogi
 Share

Question

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).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...