PHP strptime() function

Example

Parse the date/time generated by strftime():

<?php
$format="%d/%m/%Y %H:%M:%S";
$strf=strftime($format);
echo("$strf");
print_r(strptime($strf,$format));
?>

Definition and Usage

strptime() function parses the date/time generated by strftime() Generated date/time.

Note:This function is not implemented on Windows platform.

syntax

strptime(date,फ़ॉर्मैट);
parameter description
date 必需。विश्लेषण के लिए चार्ज की गई स्ट्रिंग (उदाहरण के लिए: strftime() द्वारा वापस किया गया)
फ़ॉर्मैट

必需。विन्यास को निर्धारित करें जो तारीख में इस्तेमाल किया जाना है:

  • %a - abbreviated name of the day of the week
  • %A - full name of the day of the week
  • %b - abbreviated month name
  • %B - full month name
  • %c - preferred date and time representation
  • %C - century digit (year divided by 100, range from 00 to 99)
  • %d - day of the month (01 to 31)
  • %D - date format, same as %m/%d/%y representation
  • %e - day of the month (1 to 31)
  • %g - similar to %G representation, but without century
  • %G - 4-digit year corresponding to ISO week number (see %V)
  • %h - same as %b representation
  • %H - hour, using 24-hour clock (00 to 23)
  • %I - hour, using 12-hour clock (01 to 12)
  • %j - year's day (001 to 366)
  • %m - month (01 to 12)
  • %M - minutes
  • %n - newline character
  • %p - दिये गए समय मूल्य के साथ am या pm
  • %r - a.m. और p.m. के समय चिह्न
  • %R - 24 घंटा प्रणाली के समय चिह्न
  • %S - सेकंड
  • %t - tab tabulator
  • %T - वर्तमान समय, %H:%M:%S प्रदर्शन शैली के समान
  • 趑प्ताह के दिन का नंबर (1 से 7), Monday[सोमवार] = 1. चेतावनी: Sun Solaris व्यवस्था में Sunday[रविवार] = 1
  • %U - वर्ष में समाप्त होने वाले सप्ताहों की संख्या, पहले सप्ताह के पहले दिन से सोमवार को पहला सप्ताह कहा जाता है
  • %V - 当年包含的 ISO 8601 格式下的周数(01 到 53),week 1 表示当年的第一周,至少要有四天,且以星期一作为周的第一天
  • %W - 当年包含的周数,从第一个星期一开始,作为第一周的第一天
  • %w - 以十进制数形式表示一周中的某天,Sunday[星期日] = 0
  • %x - 首选的日期表示法,不带时间
  • %X - 首选的时间表示法,不带日期
  • %y - 不包含表示世纪的数字的年份表示(范围从 00 到 99)
  • %Y - 包含表示世纪的数字的年份表示
  • %Z 或 %z - 时区名称或简写
  • %% - 输出一个 % 字符

技术细节

返回值:

如果成功,则该函数返回带有被解析日期的数组。如果失败则返回 FALSE。

वापस प्राप्त हुए आयामों के नाम का अर्थ निम्नलिखित है:

  • [tm_sec] - वर्तमान मिनट में निर्धारित सेकंड (0-61)
  • [tm_min] - वर्तमान घंटे में निर्धारित मिनट (0-59)
  • [tm_hour] - दोपहर से गए घंटे (0-23)
  • [tm_mday] - महीने में किस दिन (1-31)
  • [tm_mon] - 1 से बीते हुए महीने (0-11)
  • [tm_year] - 1900 से बीते हुए वर्ष (0-100)
  • [tm_wday] - रविवार से बीते हुए दिन (0-6)
  • [tm_yday] - 1 जनवरी से इस वर्ष में बीते हुए दिन (0-365)
  • [अनपार्सिंग] - तारीख में निर्दिष्ट तरीके से अपार्सिंग नहीं हुआ फ़ॉर्मैट पहचाने गए हिस्से
PHP संस्करण: 5.1+