دالة PHP date_date_set ()
مثال
قم بإرجاع كائن DateTime جديد ، وقم بتعيين تاريخ جديد ، ثم قم بتنسيق التاريخ:
<?php
$date=date_create();
date_date_set($date,2020,10,30);
echo date_format($date,"Y/m/d");
?>
التعريف والاستخدام
تعيّن الدالة date_date_set () تاريخًا جديدًا.
بناء الجملة
date_date_set(object, year, month, day)
قيمه المعامل
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
year | Required. Specifies the year of the date |
month | Required. Specifies the month of the date |
day | Required. Specifies the day of the date |
تفاصيل تقنية
قيمة الإرجاع: | إرجاع كائن DateTime جديد عند النجاح. خطأ في الفشل |
---|---|
إصدار PHP: | 5.2+ |
سجل التغيير في PHP: | PHP 5.3: تم تغيير القيمة المعادة من NULL إلى DateTime (عند النجاح) |
❮ PHP مرجع التاريخ / الوقت