Change date field by replacing Day and Month

Comments

6 comments

  • Rainer Grabowski

    Hi Kellie,
    you can't change  a date field with a calculation but you can show f.ex. "01/01/1960" in a calculation field.
    I assume you want to keep the year of the date field:

    var date = @date field;
    var year = moment(date).year();
    var new_date = moment("01/01" + year,"MMDDYYYY).toDate();
    new_date

    The outcome is a date in the format Months-Day-Year that looks like a date field. 

    Rainer

    0
    Comment actions Permalink
  • Podio Admin

    Hi Rainer,

    Thank you so much that worked perfectly. Just added " after YYYY and all good. 

    0
    Comment actions Permalink
  • Podio Admin

    Rainer Grabowski do you have any recommendations of online resources/training that would help me better understand calculations?

     

    0
    Comment actions Permalink
  • Podio Admin

    Rainer Grabowski

    Got another one for you! If you can help.

    Can I set a workflow for a date field as follows:

    IF YYYY = current year, empty (unset) field.

    0
    Comment actions Permalink
  • Rainer Grabowski

    IF (Sanity Check) = date("Y",strtotime([date field])) == date("Y",strtotime([Current Date]))
    Unset date field
    End IF
    Or put that into the filter section in a Custom Filter. 

    Regarding your other question: 
    You can look into https://www.w3schools.com/js/default.asp. But you have to look for ES5, not for the most recent JS version ES6, because Podio calc fields allow ES5 only. 
    Best way to learn it: Think about what you want to achieve in a calculation or in a step, formulate a google search query and check the results. Very often you'll find links to w3schools and to Stackoverflow.  Many of them can be helpful.

    For flows you need PHP. Here you find some good examples: Calc Examples  and  Using PHP Calculations

    0
    Comment actions Permalink
  • Podio Admin

    Thank you Rainer Grabowski that is perfect.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk