Results 1 to 5 of 5

Thread: message box... check date / time

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    128

    message box... check date / time

    Hi all,
    as you can't display a message box using vb.net, i have had to use javascript...

    i am using a Popup Calendar that sent the value of text boxes to the dates selected
    i need to make sure that the end date is after the start date.

    this is what i am doing at the moment...

    function CheckTime(){
    if (document.CRC.txtStartDate.value >= document.CRC.txtEndDate.value){
    var ErrMsg = "End Date Must be later than Start Date";
    alert(ErrMsg);
    return false;
    }
    }

    the problem is; example
    StartDate = 23/12/2003
    EndDate = 13/11/2003

    the code thinks that beacuse the first number is greater, then the whole number is, so it doesn't work.

    please help.
    Thanks
    Tom

  2. #2

  3. #3

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Code:
      import java.util.*; 
     
      public class X{
      private Date start;  
      private Date end;
      
      public X(){
         start = new Date(20911); //  public Date(int year, int month, int day) deprecated
         end = new Date(20921); // public Date(String s) deprecated
         dateChecker(end);       
      }
    
       public static void main(String[] args){
         new X();  
       }
     private void dateChecker(Date end){
      int i = start.compareTo(end);
      switch(i){
       case -1:{System.out.println("start is before end");}
       break;
       case 0:{System.out.println("Same dates");}
       break;
       case 1:{System.out.println("start is after end");}
       break;
      } 
     }
    }

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You're in the wrong forum. This is Java. You want JavaScript.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width