如何验证日期 [英] How to validate Date

查看:66
本文介绍了如何验证日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!



我想验证输入的日期。如果日期是11/24/2014的格式,那也没关系。但是如果格式是11/24/2014 0:00它应该返回false。



这是代码:

Hi!

I want to validate the date inputted. If the date is in this format 11/24/2014 it is okay. But if the format is 11/24/2014 0:00 it should return false.

Here is the code:

//<-- I hope to write the validation here.
//Edit format of excel date to sql date.
$date = explode("/", addslashes($data[16]));
$datePurchased = $date[2]."-".$date[0]."-".$date[1]." 00:00:00";



谢谢你,上帝保佑。


Thank you and God bless.

推荐答案

date = explode( /,addslashes(
date = explode("/", addslashes(


data [16]));
data[16]));


datePurchased =
datePurchased =


这篇关于如何验证日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆