Example Code:
<?php
date_default_timezone_set('UTC');
$time = time();
echo date('l dS F Y', $time);
echo '<br /><br />';
include('I18N_Arabic.php');
$Arabic = new I18N_Arabic('StrToTime');
$str = 'الخميس القادم';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
$str = 'الأحد الماضي';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
$str = 'بعد أسبوع وثلاثة أيام';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
$str = 'منذ تسعة أيام';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
$str = 'قبل إسبوعين';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
$str = '2 آب 1975';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
$str = '1 رمضان 1429';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "$str - $int - $date<br /><br />";
?>
Total execution time is 0.033969163894653 seconds
Amount of memory allocated to this script is 386672 bytes
Names of included or required files:
- /srv/www/vhosts/ar-php.org/httpdocs/I18N_Arabic/I18N_Arabic/Examples/ArStrToTime.php
- /srv/www/vhosts/ar-php.org/httpdocs/I18N_Arabic/I18N_Arabic.php
- /srv/www/vhosts/ar-php.org/httpdocs/I18N_Arabic/I18N_Arabic/I18N_Arabic_StrToTime.php
- /srv/www/vhosts/ar-php.org/httpdocs/I18N_Arabic/I18N_Arabic/I18N_Arabic_Mktime.php
Related Class Documentation