PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
format it outputs december 31st, 1969. If i dont try to give it the format, it outputs the correct date. Can somebody tell me what am i doing wrong? thanks!
date() expects a number for the second argument. You didn't give it a number. date's way of complaining is to give January 1st 1970, but since you're west of GMT/UTC the timezone adjustment pushed it to the day before that.
You can convert the string to a number (most of the time) with strtotime.
There is no problem with the syntax or the function the only issue is with the values you are using to get the parts of the date. The URL below will give you the exact list of parameters for date formats: -