I need to extract the start date/time from a “timer” field. I’ve used multiple Text formula fields to extract the elements and then I joined the elements in another text formula field. I’ve tried using a conditional rule to create a date field that can be recognised by the Calendar element. So far, no luck…
I struggled with this when building myself a little Time & Billing app. Here’s what I finally to work:
Assume the Timer field is called “Time Worked” You can treat it as a text field and create a text formula field equal to trim(left({Time Worked},14)) to extract the Start Date.
Similarly, you can get the elapsed time by creating a numeric formula and setting it to {Time Worked}
There HAS to be a better way (some standard Knack functions?) but I couldn’t find it and discovered this by trial and error.
My end result needs to be a date/time field that is recognised by a calendar element. Just cobbling the elements together does not seem to be sufficient for a recognised date field. The calendar does not recognise my concatenated string
@houwtama, I don’t think it’s going to be possible to parse the string into a date/equation value nicely unfortunately. I don’t tend to use Timer fields for this reason.
You’d either have to set the value of a hidden date/time field on the same form as the timer using JS code, or split the timer into two date/time fields for start and end. The latter seems most reliable.
I stand corrected, as Richard’s method works well!
The Start [formula] text formula is left({Timer},21) to extract the start date.
I’m using a calendar in my app to show time worked by day, so I solved that problem somehow, but I’m away from my desk right now. As soon as I get beck, I’ll see what I did and let you know.
So, I guess the step I left out was that after I created the Start Date text field, I let Knack convert that string to a proper date by defining From Date as a Date/Time field with a conditional rule of Set to a Field and specifying the previously described Start Date text field. That seems to take care of the conversion from text to Date/Time. You can then create your calendar using the elapsed time I previously described and the From Date field described here. Again, I found this by trial and error.