How to convert varchar2 to date in sql or mysql

897 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

Warning: Invalid argument supplied for foreach() in /home/u222619860/domains/htmlcss3tutorials.com/public_html/wp-content/plugins/anspress-question-answer/includes/reputation.php on line 320
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
Write your answer.
close