Multilingual Date and Time Class

Multilingual Date and Time Class

Multilingual Date and Time class (MDT) solution is your PHP web programming partner for dates. With our MDT, you never have to deal with the date and time headaches in php again. Let US do all the painful jobs!!!


Universal Date Format and Time Zone support

  1. All functions can support multi-format input even in the parameters of one function: System will auto-detect different date formats such as timestamp, SQL date format, date with month in word and the ambiguous date formats.
  2. User-define ambiguous date format: such as m-d-Y, d-m-Y (separator can be in ’-’, ’.’ or ’/’)
  3. User pre-defined time zone


  1. Support multilingual: All words are in user defined statements for easy translation
  2. Output format: User can pre-define date and time format of all output or over-ride default format with specific format


  1. Auto-detect multiple date formats and convert them to timestamp, SQL Date/time format, or any user defined format
  2. Calculate length of a time period with 6 precision levels from year upto second and display in user defined language.
  3. Sort dates in multiple formats and output result in standardized format
  4. Calculate the difference of 2 dates / times and return the result any of the 5 different units, that is, week, day, hr, min, sec.
    (User may also choose to show or ignore negative results.)
  5. Check if a date is fallen within a particular date range, before or after that range
  6. Extract dates in an array that are fallen within a particular date range and format them in user-defined format
  7. check number of days in current month or a given month
  8. check number of days in any month before or after a given month, eg. last month or 2 months later
  9. check if current year or a given year or the year of a given date is leap year or not
  10. leap year check of any year before or after a given year or the year of a given date
  11. Get date or time of timestamp or string in any date/time format
  12. Get information of any given date, such as day of year, name of day of the week, week number, month and year . User defines names in their own language.

For more details, please refer to

Functions list

  1. GetStamp($time=’‘)
  2. GetSQLTime($time=’‘)
  3. GetDate($time=’’,$format=output_date_format)
  4. GetTime($time=’’,$format=time_format)
  5. GetPeriod($fromtime=’’, $totime=’’, $precision = 2)
  6. GetDiff($fromtime=’’, $totime=’’, $unit=’day’,$shownegative=true)
  7. CheckRange($chktime=’’, $start=’’, $end=’‘)
  8. isLeap($time=’’,$offset=0)
  9. Days_in_month($time=’’,$offset=0)
  10. GetInfo($time=’’,$type=’weekday’,$num=true,$longname=true)
  11. GetInrange($dates=array(), $start=’’, $end=’’,$format=output_date_format)
  12. GetSort($dates=array(), $order=SORT_ASC,$format=output_date_format)

How to Use

1. Declare the PowerDateTime class with:


2 There are 2 ways to call the function. Please see below examples:

i) MDT::GetSQLTime($yourdateinfo)

ii) $a = new MDT
echo $a->GetSQLTime($yourdateinfo)

Please refer to the code file for more descriptions.

For more examples, please refer to


You may view the documentation here