public static Date fixEncounterDateTime(Date datetime){
  Date now=new Date();
  if (datetime.after(now)) {
    datetime=now;
  }
  return datetime;
}

public static Date fixEncounterDateTime ( Date datetime ) { Date now = new Date ( ) ; if ( datetime . after ( now ) ) { datetime = now ; } return datetime ; }
adjusts an encounter datetime to ensure that openmrs will accept it . the openmrs core is not designed for a client - server setup - - it will summarily reject a submitted encounter if the encounter_datetime is in the future , even if the client ' s clock is off by only one millisecond .
