# Add Year (if Not Current) to MM/DD

• 0
• Question
• Updated 2 years ago
• Answered
How would I change the formula to display the year IF it is not the current year?

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

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

If(IsNull([Date]), "",

\$MM &"/"& \$DD)

Also, if records are sorted highest to lowest by the (new) field, will higher (more recent) dates appear ABOVE the dates for the previous years?

I could sort by the [Date] field, but I concatenate the field above with another with some text details.

Thanks!
• 590 Points

Posted 2 years ago

• 0

QuickBaseCoach App Dev./Training, Champion

• 67,308 Points
No Problem

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

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

var text YYYY = IF(Year([Date]) = Year(Today()), ToText(Year([Date]));

If(IsNull([Date]), "",

List("/", \$MM,  \$DD, \$YYYY)

QuickBaseCoach App Dev./Training, Champion

• 67,308 Points
Oh and to sort just sort on your date field even though it may not be used as a column on the report.
• 590 Points

I'm sorry, I pasted exactly and got an error about mismatched parenthesis. From what I could tell, another ")" should be added at the very end, but I'm still getting the same error.

QuickBaseCoach App Dev./Training, Champion

• 67,308 Points
It was acryaully the one above whech was missing the )

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

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

var text YYYY = IF(Year([Date]) = Year(Today()), ToText(Year([Date])));

If(IsNull([Date]), "",

List("/", \$MM, \$DD, \$YYYY)
• 590 Points

For the record, I think you had = instead of <>. I corrected the formula and changed for two year characters below. Thank you!!!

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

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

var text YY = If(Year([Date]) <> Year(Today()), Right(ToText(Year([Date])),2));

If(IsNull([Date]), "",

List("/", \$MM, \$DD, \$YY))

QuickBaseCoach App Dev./Training, Champion

• 67,308 Points
Yes, I had that backwards. Glad to hear it's working.