PHP strtotime() ফাংশন

উদাহরণ

ইংরেজি টেক্সটের তারিখ-সময় বর্ণনা ইউনিক্স টাইমস্ট্যাপ-এ পরিবর্তিত করা

<?php
echo(strtotime("now") . "<br>");
echo(strtotime("15 October 1980") . "<br>");
echo(strtotime("+5 hours") . "<br>");
echo(strtotime("+1 week") . "<br>");
echo(strtotime("+1 week 3 days 7 hours 5 seconds") . "<br>");
echo(strtotime("next Monday") . "<br>");
echo(strtotime("last Sunday"));
?>

চলতি উদাহরণ

পরিভাষা ও ব্যবহার

strtotime() ফাংশন কোনও ইংরেজি টেক্সটের তারিখ বা সময় বর্ণনা কে ইউনিক্স টাইমস্ট্যাপ (January 1 1970 00:00:00 GMT থেকে থাকা সেকেন্ড) এ পরিবর্তিত করে

মনতোষ্টযদি বছর দুই সংখ্যার ফরম্যাটে প্রকাশ করা হয়, তবে 0-69 মান 2000-2069 এবং 70-100 মান 1970-2000-এ মানিত হবে。

মনতোষ্টপরিমাপ করুন m/d/y বা d-m-y ফরম্যাটের তারিখ, যদি ভাগ ড্যাগার ব্যবহার করা হয়, তবে আমেরিকান m/d/y ফরম্যাট ব্যবহার করুন। যদি ভাগ হর্ন বা ডট ব্যবহার করা হয়, তবে ইউরোপীয় d-m-y ফরম্যাট ব্যবহার করুন। যাতে কোনও ত্রুটির সম্ভাবনা থেকে বিরত থাকুন, যতটা সম্ভব YYYY-MM-DD ফরম্যাট ব্যবহার করুন বা date_create_from_format() ফাংশন ব্যবহার করুন。

Syntax

strtotime(time,now);
Parameters Description
time Required. Specifies the date/time string.
now Optional. Specifies the timestamp to be used to calculate the return value. If this parameter is omitted, the current time is used.

Technical Details

Return Value: Returns a timestamp if successful, returns FALSE if failed.
PHP Version: 4+

Update Log:

5.3.0: Now relative time formats, such as this week, last week, the previous week, the next week, specify that a week starts from Monday to Sunday, not using the 7 days before and after the current date/time.
5.3.0 Before PHP 5.3.0, 24:00 was not a valid format, and strtotime() would return FALSE.
5.2.7 In previous versions, if a specific date in a month was requested and that date was the first day of the month, it would incorrectly add a week to the returned timestamp, which has now been corrected.
5.1.0 Returns FALSE if the operation fails (in previous versions it returned -1), and added E_STRICT and E_NOTICE timezone errors.
5.0.2 Now the calculation of "now" and other relative times is based on the current time, not on midnight of today.
5.0.0 Microseconds are allowed (but the microsecond value is usually ignored).
4.4.0 Before PHP 4.4, "next" was incorrectly calculated as +2. The usual solution is to use "+1".