Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

date_isodate_set()

Example

Set the ISO date to the 5th week of 2013.

<?php
$date=date_create();
date_isodate_set($date,2013,5);
echo date_format($date,“Y-m-d”);
?>

Definition and Usage

The date_isodate_set() function sets a date according to the ISO 8601 standard, using week numbers and day offsets rather than a specific calendar date.

Syntax

date_isodate_set(object, year, week, day)

Parameter Values

 

Parameter

Description

object

Required. Specifies a DateTime object created by date_create().

year

Required. Specifies the year of the date.

week

Required. Specifies the week of the year for the date.

day

Optional. Specifies the offset from the first day of the week; the default is 1.

Technical Details

Return Value:

Returns a DateTime object on success; FALSE on failure.

PHP Version:

5.2+

PHP Changelog:

In PHP 5.3, the return value was changed from NULL to DateTime.