1

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?

2
  • 4
    Possible duplicate of Convert DateTime Value into String in Mysql Commented Apr 1, 2018 at 7:09
  • 1
    it'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. Commented Apr 2, 2018 at 12:03

1 Answer 1

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'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.