0
<?php  

    echo "Today is " . date("Y/m/d") . "<br>";
?>

Anyone know how to change the colour of the date within echo? this prints out the date but only in default black, thanks in advance.

Aniket G
  • 3,471
  • 1
  • 13
  • 39

2 Answers2

1

Method 1: You can use the line below. This is the simplest, but not the best way.

echo "<span style="color: white;"> Today is " . date("Y/m/d") . "</span><br>";

This basically prints out the date with a <span> tag around it (which has a color of white). This will make the text white.

Method 2: You can use a class.

echo "<span class="anyClass"> Today is " . date("Y/m/d") . "</span><br>";

.anyClass {
  color: white;
}
Aniket G
  • 3,471
  • 1
  • 13
  • 39
0

Try this code

echo "<p style='color: red'>Today is " . date("Y/m/d") . "</p><br>";
Usman
  • 463
  • 2
  • 9