Forum Discussion

EssenceQB_Admin's avatar
EssenceQB_Admin
Qrew Member
4 years ago

URLEncode and Now() formula

I recently downloaded a Time Clock app from the Quickbase Exchange.

I modified a URL Field that I am using to allow users to set an end time for a task. The user clicks on the button to assign a log out time to a Date/Time field. The following URL works for the most part (it gets the date correct), but the times can be random. So, I am thinking, that the the URL Encode function is scrambling the time so it is not formatted correctly when it is saved. I am not even sure if this is possible.

I must need a better way to import the current date AND time into the field. The Today() seems to put the date to noon for the current date.

URLRoot() & "db/" & [_DBID_DAILY_TIME] & "?act=API_EditRecord&rid=" & URLEncode ([Record ID#]) & "&_fid_57=" & URLEncode(Now())

Does anyone have some experience with how to format a Now() date correctly when it is being passed by a URL?

Thanks in advance,
------------------------------
Ray Moss
Essence QB Admin
Essence Cabinets Inc.
Edmonton, AB, CAN
------------------------------

1 Reply

  • So, I had to format each part of the date and time to get this to work. It will require more testing to see if it always works...

    Instead of:
    URLEncode(Now())
    Which gave me a result of: 05-27-2020%2008%3A50%20AM or 05-27-2020 08:50 AM

    I had to use:
    Month(Today()) & "-" & Day(Today()) & "-" & Year(Today()) & "%20" & Hour(ToTimeOfDay(Now())) & "%3A" & Minute(ToTimeOfDay(Now()))
    Which gave me a result of: 5-27-2020%208%3A50 or 5-27-2020 8:50

    I will be testing it throughout the day to see if it still works this afternoon. Hour() should return a 24 hour value so the AM/PM are unnecessary.

    My conclusion: NOW() returns a time based purely on the time settings of each computer; a URL needs to be in 24 hour format only. Does this make sense to anyone else? I would love someone to confirm this hypothesis.

    ------------------------------
    Ray Moss
    Essence QB Admin
    Essence Cabinets Inc.
    Edmonton, AB, CAN
    ------------------------------