Anonymous user / 3.137.192.3 Log In Register
?
Wallet: 3.00
Daily Credits:
1.20 / 1.20

PHP Functions Online


DateTime::setISODate

(PHP 5 >= 5.2.0)

DateTime::setISODate -- date_isodate_setSets the ISO date

public DateTime $object->setISODate(int $year , int $week[, int $day = 1])
public DateTime::__construct([string $time = "now"[, DateTimeZone $timezone = NULL]])
public DateTimeZone::__construct(string $timezone)

Checkout ? #

Item Description Item Price Your Price
Total

Preview #

${{ variable.param.name }} = {{ variable.param|getValue:variable.form:true }};
{{ call.result}} = ;

Tip: You can change some values by clicking on it in the preview above.

Description #

public DateTime DateTime::setISODate ( int $year , int $week [, int $day = 1 ] )

Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.

Parameters #

year

Year of the date.

week

Week of the date.

day

Offset from the first day of the week.

Return Values #

Returns the DateTime object for method chaining or FALSE on failure.

Examples #

Example #1 DateTime::setISODate() example

Object oriented style

<?php
$date 
= new DateTime();

$date->setISODate(20082);
echo 
$date->format('Y-m-d') . "\n";

$date->setISODate(200827);
echo 
$date->format('Y-m-d') . "\n";
?>

Procedural style

<?php
$date 
date_create();

date_isodate_set($date20082);
echo 
date_format($date'Y-m-d') . "\n";

date_isodate_set($date200827);
echo 
date_format($date'Y-m-d') . "\n";
?>

The above examples will output:

2008-01-07
2008-01-13

Changelog #

Version Description
5.3.0 Changed the return value on success from NULL to DateTime.

See Also #