简体   繁体   中英

Datetime not working (php+html)

I have problem with datetime input ... In HTML code I add datetime but its showing just regular form... I will post some pictures for u to beter understand what i mean... This is html code:

<form method='post'>
<br>Sport:<br>
<select name='sport'>
<option value='football' selected>Football</option>
<option value='basketball'>Basketball</option>
<option value='tennis'>Tennis</option>
<option value='hockey'>Hockey</option>
<option value='handball'>Handball</option>
<option value='volleyball'>Volleyball</option>
<option value='baseball'>Baseball</option>
<option value='waterpolo'>Water polo</option>
<option value='other'>Other</option>
</select>
<br>Starting time:<br>
<input type='datetime' name='start'/>
<br>Home:<br>
<input type='text' name='home'/><br>
Away:<br>
<input type='text' name='away'/><br>
Pick:<br>
<input type='text' name='pick'/><br>
Odd:<br>
<input type='number' step='0.01' name='odd'/><br>
Stake:<br>
<input type='number' step='0.01' name='stake'/><br>
Analysis:
<br><textarea style='width:100%;' rows='20' name='analiza'></textarea>
<input type='submit' value='Place a bet' name='postavi'/>
</form>

But datetime look like this :

在此处输入图片说明

And i dont want to look like this , i want regular datetime witch look like this :

在此处输入图片说明

Thanks everyone who try to help . Cheers , Toni.

Some browser have implemented datetime but then removed it (not sure why). To see which browsers support DateTime input check caniuse.com/input-datetime

Edit: use javascript plugin like JQuery Datepicker

Example from Jquery page:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>


</body>
</html>

You need the datepicker function that is part of the jQueryUI libray

DEMO http://jsfiddle.net/Fa8Xx/1768/

jQuery UI link

The is also the HTML5 date type attribute. This heavily relies on HTML browser support though.

DEMO http://jsfiddle.net/Fa8Xx/1769/

 <input type="date" />

I believe you need the datetime-local type instead. So the HTML would look like this:

<input type='datetime-local' name='start'/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM