$system_date = Date(m/d/Y);

<input type = "Date" value = <? echo $system_date; ?>


I want to set system date to above date box.But this will not work.If I change type to text then it will work as I want.What is the problem here.How can I set system date to text box which type is Date.Please help me.If there is any other way to do the same thing please let me know.


Recommended Answers

All 5 Replies

I didn't really understand what you want.
But you have lot of errors in this php code:


$system_date = Date("m/d/Y");

echo '<input type = "Date" value ="' . $system_date . '">';


There is no such thing as a date input type unless your developing with HTML5.

Your code needs to be:

$system_date = Date('m/d/Y');

<input type = "text" value ="<?php echo $system_date; ?>">

The date method in PHP has single or double quotes, since it is a defined function.

@cmps Yes input date is a new type defined in HTML5. Actually pretty handy.
To bad it doesn't work in older browsers(eg: IE 8) and 9 as features are limited. HTML5 is great for the upcoming web however.

Great, thank you for sharing this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.