+ Reply to Thread
Results 1 to 8 of 8

Date string to date

  1. #1
    Registered User
    Join Date
    05-27-2012
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    23

    Date string to date

    Hello.

    I want to ask how to convert date string into dates. I have a column with date string and i want a columns with dates.

    I have Excel 2007.

    Thanks.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date string to date

    Give some examples of what you have and what your results would be.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-27-2012
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Date string to date

    My problem is that i have an Excel column which stores values with a Date format+ of '01/01/2012' and I am trying to import the spreadsheet, into a SQL Server table with a
    field that has a datetime datatype.

    And this is not happening. And i am wondering if this is excel problem or not.

  4. #4
    Registered User
    Join Date
    05-27-2012
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Date string to date

    please, any help?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date string to date

    I am not understanding... your current spreadsheet has the dates formatted as dates, yes? I have never uploaded from Excel to SQL server... so not too sure about it...

  6. #6
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Date string to date

    Use =DATEVALUE. That will return an integer for Excel's date, so you may need to change the format to date. Your problem is more likely on the SQL conversion side. I would think it would prefer the text input and it would convert to its internal datetime datatype.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  7. #7
    Registered User
    Join Date
    05-27-2012
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Date string to date

    Dates DateValue
    06/06/2012 41066
    06/06/2012 41066
    11/06/2012 41071
    13/6/2012 #ΤΙΜΗ!
    13/6/2012 #ΤΙΜΗ!
    14/6/2012 #ΤΙΜΗ!
    14/6/2012 #ΤΙΜΗ!
    20/6/2012 #ΤΙΜΗ!
    20/6/2012 #ΤΙΜΗ!
    20/6/2012 #ΤΙΜΗ!
    21/6/2012 #ΤΙΜΗ!
    25/6/2012 #ΤΙΜΗ!
    26/6/2012 #ΤΙΜΗ!
    26/6/2012 #ΤΙΜΗ!
    26/6/2012 #ΤΙΜΗ!
    28/6/2012 #ΤΙΜΗ!
    04/07/2012 41094
    04/07/2012 41094
    04/07/2012 41094


    This is what i get with datevalue. I don't know any more. This seems not to be datetime but date strings.

  8. #8
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Date string to date

    Like I said, DATEVALUE will return an integer. You will need to format it to a Date (short date), and it should match the text string. This is how Excel handles dates, just a formatted integer, which is why I doubted it would work for SQL.

    I don't know what a #TIMH! error is. A Google search showed nothing, and the only error mentioned in the DATEVALUE help page is the #VALUE! error when the text string does not match a valid date. Is your system set up as dd/mm/yyyy? It seems to have given you errors on 'invalid' dates; however, 41094 is July 4th, 2012. Maybe those other dates are not text strings?

    Regardless, I still think the SQL importer should be smart enough to convert date text strings to datetime format. I would recommend checking out some of the Google results for excel to sql transfers.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1