display only month and year from date created

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
Originally posted by in the former community durning migration:
  • Asked by Jay
  • 20 days ago
I think this is a super simple formula, but for some reason it does not work in a formula field. I believe there is something wrong in my formula! Please help me fix this issue. I want to be able to just generate month and year from already existing "date created" field. I am visualizing a formula field to generate "Jan 2017" or "01-2017" from my "Date Created".

I tried "Month(ToText([Date Created]))&Year(ToText([Date Created]))", but it keeps giving me formula error saying "The types of the arguments or the number of arguments supplied do not meet the requirements of the function Month. The function is defined to be Month (Date d)."

Thank you!
Photo of Dan G. (QB Support)

Dan G. (QB Support), Official Rep

  • 490 Points 250 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Dan G. (QB Support)

Dan G. (QB Support), Official Rep

  • 490 Points 250 badge 2x thumb
Answer

Try this.  I have commented out the part that would normally put in the day of the month

var date MyDate = ToDate([Date Created]);


List("-",
Case(Month($MyDate),
1,"JAN",
2,"FEB",
3,"MAR",
4,"APR",
5,"MAY",
6,"JUN",
7,"JUL",
8,"AUG",
9,"SEP",
10,"OCT",
11,"NOV",
12,"DEC"),
//Right("0" & ToText(Day($MyDate)),2),
ToText(Year($MyDate)))


Was this answer helpful?

Answer posted by:
Original
QuickBaseCoach App Dev./Training , Mark Shnier, Principal
QuickBase Solution Provider 20 days ago



Photo of Leslie Meyer

Leslie Meyer

  • 130 Points 100 badge 2x thumb

The formula above worked great for parsing the month from the Date Created field. It did not work when parsing the month from the Date Completed field (I used the same formula but changed the field reference).  any suggestions?   I would also like a formula that parses out the year from the Data Created field.  can you provide that as well?


Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
If the field [Data Created] is a date field type, then the Year is

Year([Data Created])

If you are trying o get the month words calculated from a date field type you can just change the first line from

var date MyDate = ToDate([Date Created]);

to
var date MyDate = [Data Completed];
Photo of Leslie Meyer

Leslie Meyer

  • 130 Points 100 badge 2x thumb

It is a date field type.  When I tried your first suggestion above to get the year, I get a "formula error - bad or missing arguments in function call".  I also tried the second option above for the month from the Data Completed field, and I get the same error message.  Do you have any alternate suggestions?



Photo of Leslie Meyer

Leslie Meyer

  • 130 Points 100 badge 2x thumb

Correction. I am in business with the month...only open issue is the year.