diff --git a/examples/example_hl.f90 b/examples/example_hl.f90
index b335d55e969d73f690fbdd33d79436c786215cf1..c0b46fd9e3db6a16840fb7dce1f93e783744affa 100644
--- a/examples/example_hl.f90
+++ b/examples/example_hl.f90
@@ -26,12 +26,11 @@ PROGRAM example
   USE mo_example
 
   USE mtime,          ONLY: setCalendar, PROLEPTIC_GREGORIAN  
-  USE mtime_hl,       ONLY: t_datetime, t_timedelta
-  USE error_handling
+  USE mtime_hl,       ONLY: t_datetime, t_timedelta, min, max
   
   IMPLICIT NONE
   
-  TYPE(t_datetime)  :: dt, dt2, dt3
+  TYPE(t_datetime)  :: dt, dt2, dt3, dt4
   TYPE(t_timedelta) :: td
 
   INTEGER       :: test_number1, test_number2, test_result
@@ -86,6 +85,12 @@ PROGRAM example
   dt3 = t_datetime("1970-01-01T00:00:01")
   WRITE (0,*) dt%to_string(), " == ", dt3%to_string(), ": ", (dt == dt3)
 
+  ! min / max
+  dt4 = min(dt2,dt3)
+  WRITE (0,*) "MIN(", dt2%to_string(), ", ", dt3%to_string(), "): ", dt4%to_string()
+  dt4 = max(dt2,dt3)
+  WRITE (0,*) "MAX(", dt2%to_string(), ", ", dt3%to_string(), "): ", dt4%to_string()
+
   ! interval assignment with milliseconds
   td = t_timedelta(360000)
   WRITE (0,*) "interval assignment with milliseconds: ", td%to_string()
diff --git a/src/libmtime_hl.f90 b/src/libmtime_hl.f90
index 30eae00607f8e4da2970430f518a307daf9f3457..8199d97cc60f7a7fa0b201d2c65aa84a4f69bcf8 100644
--- a/src/libmtime_hl.f90
+++ b/src/libmtime_hl.f90
@@ -16,8 +16,13 @@ module mtime_hl
   
   private
 
+<<<<<<< Updated upstream
   PUBLIC :: t_datetime, t_timedelta
   PUBLIC :: t_timedeltaFromMilliseconds
+=======
+  public :: t_datetime, t_timedelta
+  public :: min, max
+>>>>>>> Stashed changes
 
   integer, parameter :: i8 = selected_int_kind(14)   !< at least 8 byte integer
 
@@ -94,6 +99,14 @@ module mtime_hl
   END INTERFACE t_timedeltaFromMilliseconds
 
 
+  interface min
+    module procedure t_datetime_min
+  end interface min
+
+  interface max
+    module procedure t_datetime_max
+  end interface max
+
 contains 
 
   !___________________________________________________________________________
@@ -324,6 +337,28 @@ contains
     call deallocatetimedelta(td_tmp)
   end function t_timedelta_to_string
 
+  function t_datetime_min(a,b) result(res)
+    type(t_datetime) :: a,b
+    type(t_datetime) :: res
+
+    if (a > b) then
+      res = b
+    else
+      res = a
+    end if
+  end function t_datetime_min
+
+  function t_datetime_max(a,b) result(res)
+    type(t_datetime) :: a,b
+    type(t_datetime) :: res
+
+    if (a > b) then
+      res = a
+    else
+      res = b
+    end if
+  end function t_datetime_max
+
 end module mtime_hl
 !>
 !! @}