input type date is not filled

1

I fill in a DateTime field with input type="date" and I can write it to the database normally.

When I retrieve the bank record and try to display it with the same input type, it shows me the field filled with 01/01/0001 . If I examine the source code of the page, I find that the date retrieved is there, as it was written to the database, but in dd/MM/yyyy format.

I know that input type=date needs to receive the date in yyyy-MM-dd format, but I do not know how to do that. What am I doing wrong?

    
asked by anonymous 10.07.2014 / 16:52

3 answers

2

Take the data and turn it into your View:

View

<input type="date" value="@SeuModelo.CampoData.ToString("yyyy-MM-dd")" />

Change 'YourModel.ColumnName' to the respective template, remembering that it should be type DateTime , you can also test with this:

<input type="date" value="@DateTime.Now.ToString("yyyy-MM-dd")" />
    
10.07.2014 / 19:14
0

Try this:

Look for the data in the database, via SQL as you usually do, in this example placed in this variable:

=> $dadosTrazidosDoBancoNestaArray['dataDoBanco']

And try:

$dataFormatada = trim($dadosTrazidosDoBancoNestaArray['dataDoBanco']);
$dataFormatada = date("**Y-m-d**", strtotime($dataFormatada));

Print in the field type="date" or type="text" itself, but in the case of type="text" change the date display order to " d-m-Y " to get it right.

<input readonly type="date" name='data' value="<?php echo $dataFormatada ?>">
<input readonly type="text" name='data' value="<?php echo $dataFormatada ?>">

Notice that the syntax is practically the same, however, except that it will not be displayed in the date field with the formatting in " dmY " because it will only recognize the syntax " Ymd ".

    
08.02.2015 / 04:29
0

Who to help use as follows

    <input type="date" class="form-control" name="dia" id="dia" value="<?php echo date('Y-m-d',strtotime($cli["dia"]));?>" />

Returns the value written to the bank

    
10.09.2017 / 02:15
___ ___ erkimt Error adding COUNT in CONCAT ______ qstntxt ___

When I try to add %code% it returns error, but when I shoot,% %code% works normal. Follows the error:

%code%

Script:

%pre%

I want to return this result:

%pre%

I followed this site:

  

link

Database:

TB_PEDIDO:

TB_ITEM_PEDIDO_PRODUTO:

TB_ITEM_PEDIDO_PRODUTO_INGREDIENTE:

TB_PRODUTO:

TB_PRODUTOS_INGREDIENTES:

TB_INGREDIENTES:

    
______ ___ azszpr34739

The Best Solution is to process it in the application, but if there is a reason to solve the SELECT, I suggest you use a sub-select the number of items in each product_no.

See if it works with the solution below:

%pre%     
______ ___ azszpr34733

Fields in aggregating functions as %code% % %code% %%% or co_de %code% should stay out of the clause %code% .

Try the following:

%pre%     
___ Error while uploading file to the database