Comparing Dates

Results 1 to 3 of 3

Thread: Comparing Dates

  1. #1
    Join Date
    Dec 1969

    Default Comparing Dates

    How can I compare dates in VB.<BR><BR>Let say if I have a date stored in a database like so:<BR><BR>03/12/78<BR><BR>How could I compare that with todays date<BR><BR>Let say<BR><BR>if 03/12/78 &#060; Now()<BR>then (do whatever)<BR>else (do something else)<BR><BR>Is there any format that the dates have to be <BR>converted to?<BR>Or can I just convert them as they are<BR><BR>Dates are in european format<BR><BR>dd/mm/yy<BR><BR>Ger

  2. #2
    ummmm Guest

    Default RE: Comparing Dates

    You can generally compare dates &#039;as is&#039;, but you run risks with forced-typing (in the event that something you&#039;re comparing is not actually a date). You may want to look at the datediff() function in the manual. This is a very good way to determine whether a date falls before or after another, or by how many days, etc.

  3. #3
    Join Date
    Dec 1969

    Default RE: Comparing Dates

    You can leave them as they are... OR, you can use CDate to convert it from a variant to a date... <BR><BR>There are all kinds of Date functions in VBScript that you can utilize. Check the VBScript Reference in the left pane of this page.<BR><BR>Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts