| date validation [message #70] | 
			Mon, 12 June 2006 21:06   | 
		 
		
			
				
				
				
					
						  
						semcycle
						 Messages: 8 Registered: June 2006  Location: Michigan, USA
						
					 | 
					Junior Member  | 
					 | 
		 
		 
	 | 
 
	
		it would be nice to have support for the US m(m)/d(d)/yy(yy) date format as well.  for now i have just hacked std.datevalidation.class.inc as follows 
 
  function getInternalDate ($input) 
    // convert date from external format (as input by user) 
    // to internal format (as used in the database) 
    { 
 
 
    // **************  this part changed from 
    /*   
        // look for d(d)?m(m)?y(yyy) format 
        $pattern = '(^[0-9]{1,2})'      // 1 or 2 digits 
                 . '([^0-9a-zA-Z])'     // not alpha or numeric 
                 . '([0-9]{1,2})'       // 1 or 2 digits 
                 . '([^0-9a-zA-Z])'     // not alpha or numeric 
                 . '([0-9]{1,4}$)';     // 1 to 4 digits 
        if (ereg($pattern, $input, $regs)) { 
            $result = $this->verifyDate($regs[1], $regs[3], $regs[5]); 
            return $result; 
        } // if 
    */ 
 
  // ****************** changed to 
 
    // change to m/d/y format for US users 
 
          // look for m(m)?d(d)?y(yyy) format 
        $pattern = '(^[0-9]{1,2})'      // 1 or 2 digits 
                 . '([^0-9a-zA-Z])'     // not alpha or numeric 
                 . '([0-9]{1,2})'       // 1 or 2 digits 
                 . '([^0-9a-zA-Z])'     // not alpha or numeric 
                 . '([0-9]{1,4}$)';     // 1 to 4 digits 
        if (ereg($pattern, $input, $regs)) { 
            $result = $this->verifyDate($regs[3], $regs[1], $regs[5]); 
            return $result; 
        } // if 
 
maybe somewhere along the way there could be some user preference settings such as date format, time zone etc  ? 
 
		
		
  Sem Abrahams 
www.semcycle.com
		
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	| 
		
 | 
	| 
		
 | 
	| 
		
 |