如何从Datetime-local输入中检索值? [英] How to Retrieve the value from Datetime-local input?
问题描述
我目前正在尝试使用PHP.我正在创建一个简单的表单,要求用户输入他们的姓名,电话和约会时间.用户输入所有这些值后,我想基于这些数据创建一个日历事件.(Apple ical或Google日历中的日历事件)
I am currently experimenting with PHP. I am creating a simple form that requests a user to input their, name, telephone, and appointment time. Once the user inputs all these values, I want to create a calendar event based on these data. (a calendar event in apple ical or google calendar)
我决定使用第三方框架AddEvent来帮助我创建.ical文件,以便可以将其添加到icalendar或Google日历中.但是,我遇到了一个问题.
I decided to use a third party framework, AddEvent, to help me create an .ical file so that I can add it to icalendar or google calendar. However, I ran into an issue.
我使用了datetime-local输入类型来收集约会时间问题.但是当我这样做并尝试将其回显时,它总是以特定格式打印出来,例如(2016-06-30T02:02).
I used the datetime-local input type to gather the appointment time issue. But when I do that, and try to echo it out, it always prints it out in a specific format like this (2016-06-30T02:02).
我想知道如何更改格式,就像这样(07/13/2016 16:00).
I want to know how I can alter the format so it is like this (07/13/2016 16:00).
谢谢
推荐答案
您可以使用:
echo strftime('%d/%m/%y %H:%M', strtotime($datetime_local_input));
这篇关于如何从Datetime-local输入中检索值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!