Skip to content

Designer or ViSi Parse and Check a Date String

Introduction

Designer or ViSi Parse and Check a Date String

This codebase example shows one way of parsing a date string to find the month, day, and year information and convert them to their equivalent integer values. The month, date, and year information are then tested if they are valid and if they form a valid date. To accomplish these, the program uses two functions:

    parseDate(var *stringDate, var *globaMonth, var *globalDay, var *globalYear)

and

    isValidDate(var day, var month, var year)

The function parseDate(...) extracts the month, day, and year information from stringDate and places them to the variables globalMonth, globalDay, and globalYear, respectively. If the function was able to extract the required information, it returns a "1". Otherwise, it returns a "0". This function is defined in the include file parseDateRoutines.inc.

The function isValidDate(...) checks the variables day, month, and year if they are valid and if they form a valid date. If the date is valid, it returns a "1". Otheriwse, it returns a "0". This function is defined in the include file dateTimeRoutines.inc.

If you wish to learn more about the parseDate(...) function, refer to the codebase example:

[4D-CD-00041 Designer or ViSi Routine for Parsing a Date String](../codebase/4D-CD-00041.md)

On the other hand, if you wish to learn more about the function isValidDate(...), refer to the codebase example:

[4D-CD-00023 Designer or ViSi Time and Date Validation](../codebase/4D-CD-00023.md)

Prerequisites

This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE ViSi or Designer environment. Beginners are advised to read the following aplication notes.

Instructions

Attachment

Project File