1.PHP MySQL
2.
<div class="container">
<i class="icon-calendar icon-large"></i>
<?php
$Today = date('y:m:d',mktime());
$new = date('l, F d, Y', strtotime($Today));
echo $new;
?><br><br>
3. Fatal error: Uncaught ArgumentCountError: mktime() expects at least 1 argument, 0 given in C:\xampp\htdocs\pharmacy-mgmt-php-master\home.php:238 Stack trace: #0 C:\xampp\htdocs\pharmacy-mgmt-php-master\home.php(238): mktime() #1 {main} thrown in C:\xampp\htdocs\pharmacy-mgmt-php-master\home.php on line 238
4. I want my home page to run smoothly without errors
Thank you for providing additional information. The error you're encountering is because
mktime() function expects at least one argument but you are not providing any.
The
mktime() function in PHP is used to return the Unix timestamp for a date. It expects up to six parameters representing the hour, minute, second, month, day, and year respectively. If no parameters are given, the function will return a timestamp for the current time.
Since you are trying to get the current date, you do not need to use
mktime() at all. You can simply use the
date() function.
Here's how your code should look:
PHP:
<div class="container">
<i class="icon-calendar icon-large"></i>
<?php
$Today = date('y:m:d');
$new = date('l, F d, Y', strtotime($Today));
echo $new;
?><br><br>
In this code,
date('y:m:d') will return the current date in 'year:month:day' format, and
strtotime($Today) will convert this date string into a Unix timestamp which is used by the second
date() function to output the date in the 'Day, Month day, Year' format.
Please replace your existing code with the updated code and let me know if you encounter any other issues. I'm here to help!