简体   繁体   中英

string from input: date convert to timestamp

i have this inputfield:

<input type="date" id="filter_date" class="input_filter">

and got this string "2014-10-07" from this field but i don't know how to convert this into a timestamp without changing something on the inputfield... i thought about to use a datepicker but this cant be the only solution -.- i tried some crazy parsing, converting and some functions but all of them didnt work..

so the question is how do i convert this string into a timestamp?

  CultureInfo provider = CultureInfo.InvariantCulture;
  var dateString = "2014-10-07";
  var format = "yyyy-MM-dd";
  var result = DateTime.ParseExact(dateString, format, provider);
<input name="input_filter" type="date" id="filter_date" class="input_filter">

尝试这个

echo $timestamp= strtotime($_POST['input_filter']);

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