Forum Discussion

StepanGurov's avatar
StepanGurov
Qrew Cadet
5 years ago

Add date/time field witn API_AddField

I'm tying to figure out how to add a date/time field in the table using api call API_AddField.
There's no such type mentioned in the official API reference.

------------------------------
Stepan Gurov
------------------------------

3 Replies

  • AustinK's avatar
    AustinK
    Qrew Commander
    Add that field as a date field and then use API_SetFieldProperties with the display_time tag in there. I'm sure you will need more than just that but I will link you to the help documentation.

    "display_time: Specifies whether the field shows date only in Quick Base UI or both date and time. This option turns a date field into a date-time field."

    https://help.quickbase.com/api-guide/setfieldproperties.html
    • StepanGurov's avatar
      StepanGurov
      Qrew Cadet
      Well, since for date/time fields display_time tag works properly, for date type fields it doesn't automatically switch type to date/time when applying the tag via api.

      Any api calls that can explicitly switch field type to date/time?

      ------------------------------
      Stepan Gurov
      ------------------------------
    • StepanGurov's avatar
      StepanGurov
      Qrew Cadet
      In the meantime I've figured out that setting a field type to 'timestamp' at creation is also possible (though it's not mentioned in the API reference), so it basically solves my problem :)

      ------------------------------
      Stepan Gurov
      ------------------------------