# Formulate 'Date Created' into mm/yy

• 0
• Question
• Updated 2 years ago

I want a field that reflects the date a record was created without the year and in a '01/01' format.

Thank you!

• 590 Points

Posted 3 years ago

• 0

Xavier Fan, Champion

• 450 Points
You can create a Formula Text field, with the following formula:

var Text MMYYDatewithHyphen = Right(ToFormattedText(ToDate([Date Created]), "DDMMYY"), 5);

List("/", Part(\$MMYYDatewithHyphen, 1, "-"), Part(\$MMYYDatewithHyphen, 2, "-") )

First, the "ToDate([Date Created])" converts the [Date Created] field from a Date/Time field to a Date.

Then ToFormattedText converts to a DDMMYY format - such as "12-05-16".

The Right function then takes the rightmost 5 characters - resulting in "05-16".

Now the Part function returns the appropriate part of the text, when separated by the delimiter character "-".

So Part 1 = "05", and Part 2 = "16".

Finally use the List function to string these text parts together, separated by "/".
• 590 Points
Xavier, thanks for the solution!

I removed the ToDate part after changing my field to have just the date and not the time.

I'm getting the following error: A variable declaration must end with a semi-colon.

Also, is there a way to have a days and months appear as 7 vs 07.

Thank you!

Xavier Fan, Champion

• 450 Points
Can you post your current formula?
• 590 Points
Sure:

var text MM = Right(Month([Date]),2);

var text DD = Left(ToText(Day([Date])),2);

\$MM &"/"& \$DD

Xavier Fan, Champion

• 450 Points
You were missing the "ToText" around the "Month([Date])" in the first line.

"Month([Date])" returns a number, and you need to convert it into Text.

Here's the updated formula:

var text MM = Right(ToText(Month([Date])),2);

var text DD = Left(ToText(Day([Date])),2);

\$MM &"/"& \$DD