+ Reply to Thread
Results 1 to 2 of 2




  

Thread: Converting Date from String to MySQL DateTime

      
  1. #1
    The Force is Strong! lucifersangel87 is on a distinguished road lucifersangel87's Avatar
    Join Date
    May 13, 2010
    Location
    The Midlands, England
    Posts
    11
    Rep Power
    3
    Feedback Score
    0

    Default Converting Date from String to MySQL DateTime

    Hi Guys,

    Just after a bit of advice. I've got a bit of data read from a CSV file uploaded by the user, and the data includes a date range. See below:

    "14th - 16th October 2011."

    I need to get "2010-10-14" from this as it is the start date of the event.

    I was going to go through the whole rigmarole of exploding the string and comparing each piece to a date, separating the start and end dates by "-".

    Anyone got any better / easier ideas?

    Thanks in advance,

    Martin

  2. #2
    Jedi Master mahesh10 is on a distinguished road
    Join Date
    June 17, 2010
    Location
    USA
    Posts
    239
    Rep Power
    2
    Feedback Score
    0

    Default Re: Converting Date from String to MySQL DateTime

    Hi,
    Here are some tips

    1)DECLARE @myDateTime DATETIME
    SET @myDateTime = '2008-05-03'
    Convert string
    SELECT LEFT(CONVERT(VARCHAR, @myDateTime, 120), 10)
    2)SELECT STR_TO_DATE('Wed Jun 17 12:06:00 2009', '%W %M %d %T %Y');

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Make A string for google?
    By Alex Tom in forum Google
    Replies: 5
    Last Post: Jun 25th, 2010, 3:19 am
  2. Converting Every Visitor into Subscriber
    By tblac864 in forum Work at Home
    Replies: 6
    Last Post: May 30th, 2010, 11:51 pm
  3. U Comment I Follow Search String Help
    By Sami4u in forum Google
    Replies: 4
    Last Post: Sep 27th, 2009, 11:57 pm
  4. Specific SEO Question on a URL string
    By ooen in forum SEO Forum
    Replies: 4
    Last Post: Feb 15th, 2005, 3:03 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
WebTalkForums
WebTalkForums
Recent Forum Threads