تابع ووکامرسی wc_string_to_timestamp تبدیل رشته به تایم استمپ

تابع ووکامرسی wc_string_to_timestamp – تبدیل رشته به تایم استمپ
Syntax – سینتکس
(int) wc_string_to_timestamp( $time_string, (null) $from_timestamp = null );
Parameters – پارامتر ها (2)
- 1- $time_string (null)
- 2- $from_timestamp
Usage – نحوه استفاده
if ( !function_exists( 'wc_string_to_timestamp' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php';
}
// The time string.
$time_string = null;
// The from timestamp.
$from_timestamp = null;
// NOTICE! Understand what this does before running.
$result = wc_string_to_timestamp($time_string, $from_timestamp);
Defined – محل تعریف
/includes/wc-formatting-functions.php
function wc_string_to_timestamp( $time_string, $from_timestamp = null ) {
$original_timezone = date_default_timezone_get();
// @codingStandardsIgnoreStart
date_default_timezone_set( 'UTC' );
if ( null === $from_timestamp ) {
$next_timestamp = strtotime( $time_string );
} else {
$next_timestamp = strtotime( $time_string, $from_timestamp );
}
date_default_timezone_set( $original_timezone );
// @codingStandardsIgnoreEnd
return $next_timestamp;
}
versions – نسخه ها
از نسخه : 3.0.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر