plugin-icon

TK Timestamp to Human Readable Date

제작자: Clifford Paulick·
Given a timestamp (assumed in UTC), convert to a human-readable date format using PHP named time zones.
버전
1.0.1
활성화된 설치 항목
10
최근 업데이트일
Jan 22, 2020

All Available Shortcode Arguments

'timestamp' => '', // or use the 'post_id' and 'field_timestamp' arguments 'format' => 'c', // see https://www.php.net/manual/en/function.date.php 'time_zone' => '', // defaults to WP's General Settings time zone (if valid PHP time zone), else UTC. Only supports a PHP named time zone -- see https://www.php.net/manual/en/timezones.php 'field_name' => '', // the raw name (including the `wpcf-` prefix if a Types field) or a custom field that should have a UTC timestamp as its value 'post_id' => '', // applicable if using the 'field_timestamp' argument - defaults to current post if empty

Shortcode Examples

1) Shortcode: [tk_timestamp_human timestamp="1608299220"]

(Assuming your WordPress General Settings time zone is set to ‘Europe/Amsterdam’) Expected Result: 2020-12-18T14:47:00+01:00

2) Shortcode: [tk_timestamp_human timestamp="1608299220" time_zone="America/Chicago"]

Expected Result: 2020-12-18T07:47:00-06:00

3) Shortcode: [tk_timestamp_human timestamp="1608299220" time_zone="UTC"]

Expected Result: 2020-12-18T13:47:00+00:00

4) Shortcode: [tk_timestamp_human timestamp="1608299220" time_zone="America/Chicago" format="j F, Y"]

Expected Result: 18 December, 2020

Global Function

The tk_timestamp_to_human_wp_all_export() global function is available as a wrapper for the shortcode, using all its defaults except requiring the Timestamp argument and optionally passing the Format and Time Zone parameters.

This can be handy for using with WP All Export (http://www.wpallimport.com/tour/export-developer-friendly/), such as to export a custom field that’s a UTC timestamp value to a human-readable format, such as if the system you’re moving the data to requires a specific format.

무료Business 요금제에서
설치하면 WordPress.com 서비스 약관서드파티 플러그인 약관에 동의하게 됩니다.
테스트된 버전
WordPress 5.3.20
이 플러그인은 다운로드할 수 있으며 에서 사용할 수 있습니다.