Forum Discussion

GaryBoyd's avatar
GaryBoyd
Qrew Assistant Captain
7 years ago

Day and month being swapped in date field on ""?a=API_GenAddRecordForm

I'm using "?a=API_GenAddRecordForm" & "&_fid_41=" & [Date I want] & "&_fid_42=" ...

Field 41 and 'Date I want' are both date fields.
In app properties, formatting of dates is DD-MM-YYYY (I live in Australia).
When the form opens, in field 41, the day is in the month and month is in day from the 'Date I want'.

Thank you.
  • You probably need to write a variable that will format the Date into Australia format using the function ToFormattedText([Date Field],"DDMMYYYY).  Then "encode" the variable in your API call.

    ToFormattedText (Date d, Text f)

    Description: Returns a Text value containing the formatted print representation of the Date d, using the format f.

    Example: ToFormattedText(Date(2000,01,30),"MMDDYYYY")  returns "01-30-2000"
    ToFormattedText(Date(2000,01,30),"MMDDYY")  returns "01-30-00"
    ToFormattedText(Date(2000,01,30),"DDMMYYYY")  returns "30-01-2000"
    ToFormattedText(Date(2000,01,30),"DDMMYY")  returns "30-01-00"
    ToFormattedText(Date(2000,01,30),"YYYYMMDD")  returns "2000-01-30
  • GaryBoyd's avatar
    GaryBoyd
    Qrew Assistant Captain
    Thanks I'm sure this will solve it. Seems strange and was a bit concerning that this would happen.
    • LauraThacker's avatar
      LauraThacker
      Qrew Captain
      I agree that despite setting the Application date-format to a specific format; API Calls do not seem to recognize that.  Imports can be an issue too via Excel.