Get date in Leap years php

I want to convert 59 to 2012-feb-29. I already know current year is 2012. I try following code. but it give 2012-mar-01. $string = ’59 2012′; $date1 = date_create_from_format(‘z Y’, $string); $…

Select entries between dates in doctrine 2

I will go insane with this minimal error that I’m not getting fix. I want to select entries between two days, the examples below ilustrate all my fails: opt 1. $qb->where(‘e.fecha > ‘ . $…

PHP checkdate variants

I found a php function checkdate() , but strangely enough it only seems to accept data in format of int $month , int $day , int $year. However I am passing the date as a string (example “2012-06-13”) …

PHP string date + 1 day equals?

I have a date which is saved in a regular string. // format = DD-MM-YYYY $date = “10-12-2011”; How can I get the date-string +1 day so: 11-12-2011?

Get current date, given a timezone in PHP?

I want to get todays date given a time zone in Paul Eggert format(America/New_York) in PHP?

PHP: Adding months to a date, while not exceeding the last day of the month

Looking to create a function that will do this in PHP. I need to add a number of months to a date, but not exceed the last day of the month in doing so. For example: Add 1 month to January (1-…

I have 2 dates in PHP, how can I run a foreach loop to go through all of those days?

I’m starting with a date 2010-05-01 and ending with 2010-05-10. How can I iterate through all of those dates in PHP?

Set start and end date for last 30 days ending today

I need to generate two dates in the format YYYY-MM-DD example: 2010-06-09 The end date should be today and start date should be today – 30 days. How can I generate these 2 dates in the above format?

Round minute down to nearest quarter hour

I need to round times down to the nearest quarter hour in PHP. The times are being pulled from a MySQL database from a datetime column and formatted like 2010-03-18 10:50:00. Example: 10:50 needs …

Converting to date in PHP from yyyymmdd format

I have dates in the following format (yyyymmdd, 18751104, 19140722)… what’s the easiest way to convert it to date()…. or is using mktime() and substrings my best option…?