Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Date validations

drlawdrlaw Member Posts: 11
hi,

i need to validate dates so that my START date cannot be in the past
and my END date cannot be before the start date.

i am using Datepickers for both dates. i know i have to use the 'NOW' function but i'm not entirely sure how it works.

thanks

Comments

  • zibadianzibadian Member Posts: 6,349
    : hi,
    :
    : i need to validate dates so that my START date cannot be in the past
    : and my END date cannot be before the start date.
    :
    : i am using Datepickers for both dates. i know i have to use the 'NOW' function but i'm not entirely sure how it works.
    :
    : thanks
    :
    The TDateTime type is actually a floating-point number, which lists the number of days since a certain date. This means that the END date cannot have less days than the START date. In code:
    [code]
    if double(EndDate) < double(StartDate) then
    ShowMessage('End cannot come before begin');
    [/code]
Sign In or Register to comment.