horgen horgen - 26 days ago 6
PHP Question

How to get the day of the week from a Unix timestamp (PHP)?

How do I get the day (1-7) from a Unix timestamp in PHP? I also need the day date (1-31) and month (1-12).

Answer

You can use date() function

$weekday = date('N', $timestamp); // 1-7
$month = date('m', $timestamp); // 1-12
$day = date('d', $timestamp); // 1-31