mysql 日期xammp

发布于 2024-09-30 06:22:50 字数 406 浏览 1 评论 0原文

我已在 xammp 服务器中将一个字段设置为日期。但是当我插入一个值时,它的保存类似于 0000-00-00.. 我什至像 2010-10-10 那样手动输入它,但仍然保存 000... 是我的代码或 xammp 服务器有问题吗? ??或者有什么方法可以在xammp中配置日期格式???

$今天 = 日期('Ymd');

"/>

更新.php $date = $_GET['datee'];

$qry = "INSERT INTO course_detail(userid, course_id, hours_complete, week_no, date) VALUES('$member_id','$fname','$hour','$week', '$date')"; $结果= @mysql_query($qry);

i've set a field as date in xammp server. but when i'm inserting a values, its saving like 0000-00-00.. i've even input it manually like 2010-10-10 but still saveing 000... is the problem with my code or the xammp server??? or is there any way to configure the date format in xammp???

$today = date('Y-m-d');

"/>

update.php
$date = $_GET['datee'];

$qry = "INSERT INTO course_detail(userid, course_id, hours_complete, week_no, date) VALUES('$member_id','$fname','$hour','$week', '$date')";
$result = @mysql_query($qry);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离旧人 2024-10-07 06:22:50

可能和你的代码有关。插入时是否引用了日期字符串?

INSERT INTO mytable SET datefield='2010-10-10'

It's probably with your code. Have you quoted the date string when inserting?

INSERT INTO mytable SET datefield='2010-10-10'
甜妞爱困 2024-10-07 06:22:50

这绝对不是 XAMPP 问题。我强烈建议您查看此链接有关日期时间的 MySQL 文档

MySQL Date 有固定的语法,通常遵循 YYYY-MM-DD 或 YYYYMMDD 的格式。我确信您正在使用 MySQL 上的表示层,例如 *.NET(ASP、winforms),您可以重新格式化 MySQL 生成的日期以匹配您的区域设置。以下是在 Microsoft 堆栈上执行此操作的方法MSDN 全球化分步,类似的方法适用于您可能使用的任何其他技术。

This is definitely not a XAMPP issue. I highly recommend you take a look at this link MySQL Documentation on Datetime

MySQL Date has a fixed syntax and it generally falls along the lines of YYYY-MM-DD or YYYYMMDD. I'm sure you're using a presentation layer over MySQL such as *.NET (ASP,winforms), you can reformat the date generated by MySQL to match your locale. Here's how you do it on the Microsoft stack MSDN Globalization Step-by-Step, similar methods are available for whatever else technology you may be using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文