MySQL Forums
Forum List  »  Newbie

-STR_TO_DATE help
Posted by: Ben Stanton
Date: July 20, 2011 12:49PM

Is there anyway to use STR_TO_DATE against a field?

Here's a query that works for me
SELECT STR_TO_DATE('(5/18/2009 9:34:58 AM)', '(%c/%e/%Y %r)') AS NewDateTime;

It will return
2009-05-18 09:34:58

But instead of having to input '(5/18/2009 9:34:58 AM)' in the SELECT statement, is there anyway I can use a field to act as the input?

This query does not work :(

SELECT STR_TO_DATE(OS_INSTALLED_DATE, '(%c/%e/%Y %r)') AS NewDateTime
from ORG1.MACHINE

I need the text in the field "OS_INSTALLED_DATE" into a date-friendly field, "NewDateTime".

Ideas?



Edited 1 time(s). Last edit at 07/20/2011 02:11PM by Guelphdad Lake.

Options: ReplyQuote


Subject
Written By
Posted
-STR_TO_DATE help
July 20, 2011 12:49PM
July 20, 2011 02:18PM
July 20, 2011 03:12PM
July 20, 2011 02:24PM
July 20, 2011 03:15PM
July 20, 2011 08:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.