Arabic StrToTime:

Parse about any Arabic textual datetime description into a Unix timestamp.

The function expects to be given a string containing an Arabic date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 GMT), relative to the timestamp given in now, or the current time if none is supplied.


Example Output 1:


'; /* // Autoload files using Composer autoload require_once __DIR__ . '/../vendor/autoload.php'; */ require '../src/Arabic.php'; $Arabic = new \ArPHP\I18N\Arabic(); $str = 'الخميس القادم'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; $str = 'الأحد الماضي'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; $str = 'بعد أسبوع و ثلاثة أيام'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; $str = 'منذ تسعة أيام'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; $str = 'قبل إسبوعين'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; $str = '2 آب 1975'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; $str = '1 رمضان 1429'; $int = $Arabic->strtotime($str, $time); $date = date('l dS F Y', $int); echo "$str - $int - $date

"; ?>

Example Code 1:


'; \$Arabic = new \\ArPHP\\I18N\\Arabic(); \$str = 'الخميس القادم'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; \$str = 'الأحد الماضي'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; \$str = 'بعد أسبوع و ثلاثة أيام'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; \$str = 'منذ تسعة أيام'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; \$str = 'قبل إسبوعين'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; \$str = '2 آب 1975'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; \$str = '1 رمضان 1429'; \$int = \$Arabic->strtotime(\$str, \$time); \$date = date('l dS F Y', \$int); echo "\$str - \$int - \$date

"; END; highlight_string($code); ?>
Related Documentation: strtotime

Example Output 2:

diffForHumans($time, $other); echo "$str

"; $str = $Arabic->diffForHumans($time, $other, 3); echo "$str

"; $str = $Arabic->diffForHumans($time, $other, 3, false); echo "$str

"; $str = $Arabic->diffForHumans($other, $time, 7); echo "$str

"; ?>

Example Code 2:

diffForHumans(\$time, \$other); echo "\$str

"; \$str = \$Arabic->diffForHumans(\$time, \$other, 3); echo "\$str

"; \$str = \$Arabic->diffForHumans(\$time, \$other, 3, false); echo "\$str

"; \$str = \$Arabic->diffForHumans(\$other, \$time, 7); echo "\$str

"; END; highlight_string($code); ?>
Related Documentation: diffForHumans