How to convert datetime
to string format in SQL query for example just like in PHP there is function of strtotime()
how can we do that in SQL query?
Asked
Active
Viewed 153 times
1

Grant Miller
- 27,532
- 16
- 147
- 165

Creative Developers
- 69
- 10
-
4Possible duplicate of [Convert DateTime Value into String in Mysql](https://stackoverflow.com/questions/2392413/convert-datetime-value-into-string-in-mysql) – Shahnawaz Kadari Apr 01 '18 at 07:09
-
1it's a practice to not apply complex operations in db level (string manipulation) in case you would like to have an agile and responsive backend. – Evhz Apr 02 '18 at 12:03
1 Answers
1
If this oracle sql, you can use to_char (dateValue , formatMask) function. For example, TO_CHAR(sysdate, 'yyyy/mm/dd hh24:mi:ss') Result: '2003/07/09 12:04:20 ' TO_CHAR(sysdate, 'Month DD, YYYY') Result: 'July 09, 2003'

SevincQurbanova
- 366
- 1
- 7