Check box which generates today’s date only

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Check box which generates today’s date only

Viewing 1 reply thread
  • Author
    Posts
  • November 20, 2019 at 6:55 AM #38125

    Simon Inchley
    Participant

    Hi there. I trying to create a check box field (called “paid”) that then generates todays date in another field (called “date paid”) when checked. I used a calculation field for the “date paid” field and wrote this:

    if( PAID =”1″;TODAY();0)

    I turned the calculation result type to “date”. On the “date paid” field I turned the default date to dd/mm/yyyy which gets rid of the seconds.

    It works great except for it shows 01/01/1970 when the “paid” field is unchecked, which I understand is to do with how when is calculated from time.

    So my question is: is there any way for the calculation to leave a blank field if the date field is not checked, just giving me a date for when I check it? Or do I have to do this through scripting?

    November 20, 2019 at 11:44 PM #38144

    Brendan
    Keymaster

    The reason you’re getting January 1, 1970 is because dates are represented in the Unix Epoch format, which is the number of seconds that have elapsed since January 1, 1970 00:00:00 GMT. So consequently, a value of 0 gives you that date because no time has elapsed.

    You might consider returning Text instead and then using the DATE() function to format the date to your liking instead. IF(PAID = 1; DATE(TODAY(); "dd/MM/yyyy"); ""). So that’ll return today’s date formatted as dd/MM/yyyy if PAID = 1 or the empty string if it’s anything else.

Viewing 1 reply thread

You must be logged in to reply to this topic.