Integer to Datetime SQL [closed] - mysql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need convert this integer "1469416462" to datetime in format dd-mm-yyyy hh:mm:ss . Any ideas?
My Intent:
select CONVERT (datetime,1469416462)

The value 1469416462 looks like a Unix-Timestamp.
Unix-Timestamp: Seconds since 1.1.1970
So the solution would be easy like:
For MySQL:
SELECT from_unixtime(1469416462)

Related

How to return 'year' from the date if the date format is (dd-mm-yyyy) in mysql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am trying to show the dates in (YYYY-MM-DD) format which is stored in (DD-MM-YYYY) format in the table.
Also please explain how to use year() function on (DD-MM-YYYY) date format.
assuming your data type is a string then you could use
for format(DD-MM-YYYY)
select year(str_to_date(yourcol, '%d-%m-%Y'))
or for format (YYYY-MM-DD)
select year(str_to_date(yourcol, '%Y-%m-%d'))

"I want to compare the dates of second month" display all the dates of February(02) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I want to compare the dates of 2nd month.
Display only dates that are in second month
by using sql query
hope this will help you:
SELECT BirthDate FROM Employees where EXTRACT(MONTH FROM BirthDate)=2;

Convert mm/dd/yyyy string into timestamp in MySQL [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a column in a MySQL table where dates are stored as a mm/dd/yyyy string. I need to preserve that column as is, so I have added a new column where I want to store that date as a timestamp. What would the query look like to take column a and convert it to a timestamp and put it into the new column b?
you can use STR_TO_DATE to convert your string like
select str_to_date('02/22/2013','%m/%d/%Y');
UPDATE YourTable set newCol = str_to_date(yourOldCol,'%m/%d/%Y');

date in 'dd-mmm-yyyy' varchar to date type in sql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a date field in my table which is of the type varchar. It's in the format '15-jul-2015'. I want to convert it to date type in sql. The other questions where I looked for an answer didn't have answers to my perticular case. If the answer was there I couldn't find/understand it. I am new to sql and will really appreciate a detailed solution.
Use str_to_date:
SELECT STR_TO_DATE('15-jul-2015','%d-%M-%Y');
see the mysql documentation for more informations.

mysql str to time [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Looking at the time functions but need help to convert time from
"18:00:00" to 6 PM in the SQL language.
You can convert the string to a time and then convert the value to a string using date_format():
select date_format(cast('18:00:00' as time), '%h %p')