0

In the code below I tried to display datetime value from DB in input which it's type is datetime. The problem is that I dont know what is the correct format to do so.

<input class="form-control" name="date_to_discuss" id="date_to_discuss" type="datetime-local"
value="<?php echo date_format($proposal["Date_To_Disscus"], 'Y-m-dTH:i:s');?>" />

I tried to look for answers in the internet but it was useless..

2

1 Answer 1

1

Try this:

<?php
$proposal["Date_To_Disscus"] = '2017-04-12';
?>
<input class="form-control" name="date_to_discuss" id="date_to_discuss" type="datetime-local"
value="<?php echo strftime('%Y-%m-%dT%H:%M:%S', strtotime($proposal["Date_To_Disscus"]));?>" />

OUTPUT:

2017-04-12T00:00:00

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.