+ Reply to Thread
Results 1 to 9 of 9

convert to datetime

  1. #1
    Registered User
    Join Date
    06-07-2017
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    4

    convert to datetime

    Hello,

    I need help with a formula to convert a field with 5/5/2017 12:31 to a datetime, how can I do this please?

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: convert to datetime

    That looks like it already is a Date and Time..
    If that is stored as a text string, then you can simply add 0 to convert it to numerical date/time.
    =A1+0

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: convert to datetime

    Hi and welcome to the forum.

    Are you sure it isn't already a date.time number
    Have you tested it with an =ISNUMBER(A1) to see if you get the answer TRUE
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    06-07-2017
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    4

    Re: convert to datetime

    Thanks for the reply, how do I convert it into a format that would be recognized as a datetime in a sql db?

  5. #5
    Registered User
    Join Date
    06-07-2017
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    4

    Re: convert to datetime

    Quote Originally Posted by Richard Buttrey View Post
    Hi and welcome to the forum.

    Are you sure it isn't already a date.time number
    Have you tested it with an =ISNUMBER(A1) to see if you get the answer TRUE
    That value is True... Problem I am having is when I import the column into a db I get 00-00-0000

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: convert to datetime

    Maybe you need the opposite, and have it converted from real date/time into a text string.

    Try
    =TEXT(A1,"m/d/yyyy hh:mm")

  7. #7
    Registered User
    Join Date
    06-07-2017
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    4

    Re: convert to datetime

    Quote Originally Posted by Jonmo1 View Post
    Maybe you need the opposite, and have it converted from real date/time into a text string.

    Try
    =TEXT(A1,"m/d/yyyy hh:mm")
    Jonmo1 that certainly makes sense to me, but it did not work. I think if I just cut off the time and just use date I will be good, is there a formula for that? I can simply format to be a date, but I think it still leaves the time in there as well.

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: convert to datetime

    To return the date only without the time

    This returns as an actual date value.
    =INT(A1)

    This will return a date TEXT string
    =TEXT(A1,"m/d/yyyy")

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: convert to datetime

    Quote Originally Posted by uinthas View Post
    Hello,

    I need help with a formula to convert a field with 5/5/2017 12:31 to a datetime, how can I do this please?
    What do you actually want to SEE?

+ 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. [SOLVED] Move all files in a folder to a new folder it datetime less the latest datetime
    By capson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2016, 10:31 AM
  2. Different datetime from dbf
    By mdek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2016, 07:20 PM
  3. if statement for datetime value between two other datetime values
    By OSepulvedaIII in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-15-2016, 10:37 AM
  4. [SOLVED] ISO datetime difference
    By NDBT85 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2014, 10:12 AM
  5. Powerpivot: Convert Datetime to Weekly format (mm/dd - mm/dd)
    By thagasa in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-14-2013, 07:40 PM
  6. formatting datetime, US vs. UK
    By kmfdm515 in forum Excel General
    Replies: 5
    Last Post: 05-05-2012, 03:16 AM
  7. Based on a Column datetime value auto calculate and populate a datetime range
    By rajashanmuga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2010, 04:10 PM

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