如何存储“1/01/1900 3:54:32 a.m.”在MySQL? [英] How to store "1/01/1900 3:54:32 a.m." in MySQL?

查看:128
本文介绍了如何存储“1/01/1900 3:54:32 a.m.”在MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将CSV文件中的数据保存到MySQL数据库中。我使用Laravel,并试图决定什么是最好的方式来存储这样的数据。请参阅: http://laravel.com/docs/4.2/schema#adding-columns。我使用 timestamp 吗?

I'm saving data from a CSV file into a MySQL database. I'm using Laravel and trying to decide what is the best way to store such data. See: http://laravel.com/docs/4.2/schema#adding-columns. Do I use timestamp? Would I lose anything if I just stored it as a string?

推荐答案

使用 datetime



字符串 datetime 的优点是它将被更有效地存储,使用更多工具查询此数据

Use datetime

The advantage of datetime over string is that it will be stored more efficiently and you will be able to query this data with more tools

阅读更多文档

这篇关于如何存储“1/01/1900 3:54:32 a.m.”在MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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