I need to work with date function but I want to get day and month numerical and separate and pass it to a function.

For example, I want work for this function.


How can I get date of today on pass it to a function aside?


I think this will work for you (tried it and it works):

date('m', strtotime('0 month'));
date('d', strtotime('0 day'));

Here is a discussion on the topic.


You can use the following functions:

time ();

return The time by seconds


y- Year m- Month d- Day

h- Hours i- Minute s- Second

for ex:

date("Y-m-d H:i:s");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.