0

I am trying to create a function that takes a unix timestamp from the mktime() function as an argument, and then displays the full date for my birthday in the year 2025.

So far I have created the function as:

function displayDate(mktime(2025-07-22))

I am very new at php and not sure if this would be the proper way to start. If it's acceptable, how do retrieve that information for the echo statement that displays the full date, ie, Thursday July 22 2025. Any help would be much appreciated!

still2blue
  • 193
  • 1
  • 18

1 Answers1

1

You want to use strtotime and date function to do that.

function futureDate($dateString) {
    echo date('l F j Y', strtotime($dateString));
}

futureDate('2025-07-22');

And Btw, 2025-07-22 is a Tuesday

Diego Fu
  • 410
  • 2
  • 10
  • Thank your for your response! I have learned about strtotime yet but I can certainly see it's use. Could you elaborate on my initial example though? I would like to know if what I have is usable and how I would also do this with just the mktime function. – still2blue Sep 04 '15 at 17:12
  • That works just fine and gives me the output, but again, I need to use mktime for this project. Can anyone explain how I would do the same thing using the function but with mktime instead of strtotime? – still2blue Sep 04 '15 at 17:37