How to convert varchar2 to date in sql or mysql

1.28K views
0
0 Comments

I want to convert a string from varchar 2 to Date in DD-MM-YYYY format. I am storing the date as a string in the ’01-09-2021′ format. I want to pass a date field in SQL query as a date format to retrieve the data using between.

 

 

 

htmlAdmin2609 Changed status to publish January 29, 2021
Add a Comment
0

You can simply use the date_format() to convert from varchar2 to date.

Syntex

OR

MySQL CAST() Function: You can also convert a string value to date datatype

select cast("02-08-2020" as date);

Try this

https://stackoverflow.com/questions/18597051/sql-date-format-convert-dd-mm-yy-to-yyyy-mm-dd

 

 

 

 

 

 

 

 

 

htmlAdmin2609 Changed status to publish January 29, 2021
Add a Comment
You are viewing 1 out of 1 answers, click here to view all answers.
Write your answer.
close