Can I set PHP's Interal Date and Time to months before?

I am wondering if I can change PHP's overall date, to think its really at about 2 months ago, or 2011 if I want.

If it's "No, you must use the DateTime class and set the system up to run through there", that would be the chosen answer.

The reason is because I have a massive project using an API thats based on many schedules.


You can do that by setting the system date, however you really shouldn't.

Just use PHP's datetime and adjust accordingly. If you don't want to set the month everytime you want to use datetime functions simply create a wrapper class which does this for you and call that.

PHP5 provides DateTime and DateInterval

2 months ago from now:

$date = new DateTime(); // Time now
$date->sub(new DateInterval('P2M')); // Substract a Period (P) of Two (2) Months (M)

Need Your Help

changing UIImageView frame size programmatically

ios uiimageview frame

I have a UImageView with initial dimensions set from the xib as:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.