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]
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ____ ( http://forcoder.org ) free video tutorials and ebooks about < Go, Java, PL/SQL, Delphi, R, MATLAB, C#, Scratch, C++, PHP, Objective-C, Perl, C, Visual Basic, Swift, JavaScript, Assembly, Ruby, Visual Basic .NET, Python Rust, Hack, VBScript, Prolog, Transact-SQL, Kotlin, LabVIEW, Lua, ABAP, Fortran, Scheme, Lisp, Alice, Apex, Scala, Clojure, Logo, COBOL, D, FoxPro, ML, Ada, Awk, Crystal, Bash, Dart, SAS, Julia, Erlang, F# /> __

Sign In or Register to comment.