How to show current day date in meta title of a page?

Is there any method to show current date in meta title of a page in a html website ?

<meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 <title> </title>
    <meta name="description" content="There may be many reasons why you cannot login to webmail. Check your username and password.">
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday",
var monthNames = new Array(
var now = new Date();
document.title(now.getDate() + " " + monthNames[now.getMonth()] + ", " + now.getFullYear());
var docTitle = document.title;

This is the code which is showing date in page , but I want to show the date in head title.

Sure thing. The most reliable way is using PHP or some other server-side language to add the date when it generates the page.

I’ve moved this thread from JavaScript to the PHP forum so that they can help to advise further.

How to do it?

Hi there shobhapatwal,

this code…

<html lang="en">

<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">

<title><?php echo date("D/M/Y");?></title>



…saved as a PHP file would produce this output…



1 Like

As mentioned use serverside PHP to find the result of the date(…) function:

Generate the index.html webpage source and insert the results from the date function.

Ninjaad by @coothead

1 Like

Hi there John,

I was just going to edit my post for a further
reading link
but you beat me to it. :winky:

Nijaad by @John_Betong


1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.