yuki
yuki

Reputation: 43

Change datepicker display format (php)

how can i change the display format of date picker?

<tr>
  <td width="30%"><label>Date Registered</label</td>
  <td >'.$row["dateRegistered_vehicle"].'</td>
</tr>

using the date attributes, the data would be displayed as 2017/08/21. how can i change this to 21/08/2017?

ive used datepicker in the insert form and does show the value as i want. but when i want to display the date in a table(html), the date come out as 2017/02/21 instead of 21/02/2017.

Upvotes: 0

Views: 3664

Answers (2)

Valerie Bantilan
Valerie Bantilan

Reputation: 121

Use the date built in method of php. These websites are helpful:

1) http://php.net/manual/en/datetime.formats.date.php

2) https://www.w3schools.com/php/func_date_date.asp

Anyways here is the answer to your question.

date("d-m-Y", strtotime($row["dateRegistered_vehicle"]));

Hope it helps.

Upvotes: 1

Rtra
Rtra

Reputation: 522

This how you will change the date format

<?php
date("d/m/Y", strtotime($row["dateRegistered_vehicle"]));
?>

also DatePicker format

<script>
$('#date_field').datepicker({
        format: 'dd/mm/yyyy'
});
</script>

Upvotes: 1

Related Questions