Setting the Format to Use for Date Fields

Date format strings are used by Vermont Views to allow flexibility in entering dates in a variety of formats. By using a date format string, you can use dates in any number of formats from U.S. style (month/day/year) to European style (day/month/year) to just the month and year.

By default, date fields use the global system date format string SYSDATEFMT as the date format. SYSDATEFMT is initialized by the system to "MM/DD/YY" (this is the same as US_DATE).

To change SYSDATEFMT, use the set environment date format function, se_datefmt():

void se_datefmt(format_stp)

UCHAR *format_stp;        /* Pointer to format string                */

Any date field defined after making this call will use the changed SYSDATEFMT.

You can also change the date format for any particular field so that it is different from the system date format. You can do this in the Designer or in your code. To do this in code, use the set field date format function, sf_datefmt():

void sf_datefmt(format_stp, dfldp)
 
UCHAR *format_stp;
/* Pointer to format string
*/
DFIELDPTR dfldp;
/* Pointer to a date field
*/

Note: The date format must match the picture for the field, or a memory overwrite may occur.


Home Contents Previous Next