Hi. I'm retrieving a record and populating the data into input fields. there is a column called fld_order_date type timestamp. How do i retrieve the date?

i have the usual retrieval:

    $stmt = $conn->prepare("SELECT * FROM tbl_orders_a154287 WHERE fld_order_id = :oid");

    $stmt->bindParam(':oid', $oid, PDO::PARAM_STR);

    $oid = $_GET['edit'];

    $stmt->execute();

    $editrow = $stmt->fetch(PDO::FETCH_ASSOC);

the input field :

<input name="orderdate" type="date" readonly value="<?php if(isset($_GET['edit'])) echo $editrow['fld_order_date']; ?>">

right now what displays in the textbox is : dd/mm/yyyy

First, do not SELECT*. Specify the column names you want.

SELECT 
  column1
, column2
, date_format(fld_order_date, '/%d%m/%Y') AS fld_order_date
FROM table
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.