PA_SetDateField

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_SetDateField (tNum; fNum; day; month; year)

ParameterTypeDescription
tNumshortTable number of the field to access
fNumshortField number of the field to access
dayshortNew day of the date field
monthshortNew month of the date field
yearshortNew year of the date field

Description

The routine PA_SetDateField sets the value of the date field number fNum of the current record of table number tNum to *day, *month, and *year.

If the field is not a time field, the routine does nothing and sets an error in PA_GetLastError().

Example

Set a field date to the current date under MacOS.

   void SetFieldToCurrentDate (short tNum, short fNum)
   {
      unsigned long   secs;
      DateTimeRecord   dtr;
      GetDateTime(&secs);
      SecondsToDate(secs, &drp)
      PA_SetDateField(tNum, fNum, drp.day, drp.month, drp.year);
   }

This can be done using 4D itself, wth the "Date" function (neither error checking here nor localization)

   void SetFieldToCurrentDate (short tNum, short fNum)
   {
      PA_Variable   currentDate;

      currentDate = PA_ExecuteFunction("Current date", 12);
      PA_SetDateField(tNum, fNum, currentDate.day, currentDate.month, currentDate.year);
   }

See Also

PA_GetDateField.

Error Handling

Use PA_GetLastError to see if an error occurred (eER_InvalidFileNumber, eER_InvalidFieldNumber)


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next