Discussions

Expand all | Collapse all

display only month and year from date created

  • 1.  display only month and year from date created

    Posted 02-27-2017 16:13
    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!


  • 2.  RE: display only month and year from date created

    Posted 02-27-2017 16:15
    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





  • 3.  RE: display only month and year from date created

    Posted 09-26-2017 19:22

    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?




  • 4.  RE: display only month and year from date created

    Posted 09-26-2017 19:26
    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];


  • 5.  RE: display only month and year from date created

    Posted 09-26-2017 19:34

    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?





  • 6.  RE: display only month and year from date created

    Posted 09-26-2017 19:36

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