我有不同日期时间格式的数据,我希望他们将它们转换为相同的日期时间格式

发布于 2025-01-15 21:28:44 字数 350 浏览 0 评论 0原文

例如,

我当前的列数据是

21-04-2022 14:30:00
02-03-2021 14:30:00
2021-05-02 14:30:00
2022-06-21 14:30:00

我希望我的数据具有相同的日期时间格式。

2022-04-21 14:30:00
2021-03-02 14:30:00
2021-05-02 14:30:00
2022-06-21 14:30:00

我不希望时间发生变化,但问题是日期和时间都在一列中,所以我想要一个正确的解决方案,通过它我可以转换我的数据

我尝试了不同的方法,但没有任何帮助。

For Example

my current column data is

21-04-2022 14:30:00
02-03-2021 14:30:00
2021-05-02 14:30:00
2022-06-21 14:30:00

I want my data is same date time format.

2022-04-21 14:30:00
2021-03-02 14:30:00
2021-05-02 14:30:00
2022-06-21 14:30:00

I don't want changes in time but the thing is both date and time are in one column so i want a proper solution through which i can convert my data

i have tried different methods but nothing is helpful.

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

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

发布评论

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

评论(1

为人所爱 2025-01-22 21:28:44

首先,您必须将 varchar 的类型更改为 datetime
然后使用 INSERT INTO table Values('2022-04-21 14:30:00'); 添加日期

除了您已输入的数据之外,例如:


INSERT INTO table VALUES('2022-04-21 14:30:00');
INSERT INTO table VALUES('2021-03-02 14:30:00');
INSERT INTO table VALUES('2021-05-02 14:30:00');
INSERT INTO table VALUES('2022-06-21 14:30:00');

注意: 在显示表格的地方添加您的表格名称

First of all you have to change the type of varchar to datetime
And then add the date with INSERT INTO table Values('2022-04-21 14:30:00');

In addition to the data you have already entered, for example :


INSERT INTO table VALUES('2022-04-21 14:30:00');
INSERT INTO table VALUES('2021-03-02 14:30:00');
INSERT INTO table VALUES('2021-05-02 14:30:00');
INSERT INTO table VALUES('2022-06-21 14:30:00');

Note : Where it says table add your table name

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