Shivam Patel
Shivam Patel

Reputation: 23

I have a data which are in different date time formats and i want them to convert them into same date time format

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.

Upvotes: 2

Views: 50

Answers (1)

Javier G.Raya
Javier G.Raya

Reputation: 250

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

Upvotes: 1

Related Questions