Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 23, 2013 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/5020498 to your computer and use it in GitHub Desktop.
Save shigemk2/5020498 to your computer and use it in GitHub Desktop.
DateIntervalを使ってみよう
<?php
$date = new DateTime('2000-01-20');
$date->sub(new DateInterval('P12M')); // 12ヶ月前
echo $date->format('Y-m-d') . "\n"; // 1999-01-20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment