| Server IP : 104.26.3.156 / Your IP : 216.73.216.185 Web Server : nginx/1.27.1 System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 User : vinodai ( 3134) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v1396/wwwindicidolscom/public_html/wp-content/plugins/give/src/Helpers/ |
Upload File : |
<?php
namespace Give\Helpers;
/**
* @since 2.20.0
*/
class Date {
/**
* Returns human readable date.
*
* @param string $datetime A date/time string
* @since 2.20.0
*
* @return string
*/
public static function getDateTime($datetime) {
$dateTimestamp = strtotime($datetime);
$currentTimestamp = current_time('timestamp');
$todayTimestamp = strtotime('today', $currentTimestamp);
$yesterdayTimestamp = strtotime('yesterday', $currentTimestamp);
if ($dateTimestamp >= $todayTimestamp) {
return sprintf(
'%1$s %2$s %3$s',
esc_html__('Today', 'give'),
esc_html__('at', 'give'),
date_i18n(get_option('time_format'), $dateTimestamp)
);
}
if ($dateTimestamp >= $yesterdayTimestamp) {
return sprintf(
'%1$s %2$s %3$s',
esc_html__('Yesterday', 'give'),
esc_html__('at', 'give'),
date_i18n(get_option('time_format'), $dateTimestamp)
);
}
return sprintf(
'%1$s %2$s %3$s',
date_i18n(get_option('date_format'), $dateTimestamp),
esc_html__('at', 'give'),
date_i18n(get_option('time_format'), $dateTimestamp)
);
}
}