更改datepicker显示格式(php)

时间:2017-06-05 01:57:53

标签: php

如何更改日期选择器的显示格式?

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

使用日期属性,数据将显示为2017/08/21。 我怎么能改变这个到2017年8月21日?

我已经在插入表单中使用了datepicker,并且确实显示了我想要的值。但是当我想在表格(html)中显示日期时,日期是2017/02/21而不是2017年2月21日。

2 个答案:

答案 0 :(得分:1)

这将改变日期格式

library(dplyr)
df %>%
  mutate(type = sub("^((Journal|Conference))", "Other", type)) %>%
  group_by(year, type) %>%
  summarise(n = sum(n))


#  year       type     n
#  <int>      <chr> <int>
#1  1994 Conference     2
#2  1994    Journal     3
#3  1995 Conference    10
#4  1995      Other     3
#5  1996 Conference    20
#6  1996      Other     5

也是DatePicker格式

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

答案 1 :(得分:1)

使用php方法中构建的日期。 这些网站很有帮助:

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

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

无论如何,这是你问题的答案。

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

希望它有所帮助。