遇到一个非良好的数值 [英] A non well formed numeric value encountered

查看:101
本文介绍了遇到一个非良好的数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格通过两个日期(开始和结束)到一个PHP脚本,将它们添加到一个DB。我在验证此问题时遇到问题。我不断收到以下错误



遇到的格式不正确的数值



这是当我使用以下

  date(d,$ _ GET ['start_date']); 

但是当我使用许多网站建议的 strtotime()我获得了1/1/1970的unix时间戳记日期。
任何想法如何获得正确的日期?

解决方案

当您安装了PHP 5.2.0或更高版本时,您可能需要检出新的DateTime功能,请查看一些快速介绍的此链接:
http://nl3.php.net/manual/en/datetime.format.php


I have a form that passes two dates (start and finish) to a PHP script that will add those to a DB. I am having problems validating this. I keep getting the following errors

A non well formed numeric value encountered

This is when I use the following

date("d",$_GET['start_date']);

But when I use the strtotime() function as advised by many sites I get a unix timestamp date of 1/1/1970. Any ideas how I can get the correct date?

解决方案

When you have PHP 5.2.0 or higher installed, you might want to checkout the new DateTime functionalities, take a look at this link for some quick intro's: http://nl3.php.net/manual/en/datetime.format.php

这篇关于遇到一个非良好的数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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