+ Reply to Thread
Results 1 to 6 of 6

deleting out seconds from a date

  1. #1
    Forum Contributor
    Join Date
    09-30-2015
    Location
    LA my baby
    MS-Off Ver
    2013
    Posts
    727

    deleting out seconds from a date

    Hello. I have dates with 1/1/2016 12:30:00 PM for example. I wanted to match them to dates (1/1/2016) but the dates don't match because the minutes don't match (I believe that's why they don't match). How can I delete the minutes off?

    ALSO, this format is already in powerpivot. Can I change it in there (I don't think changing just the format will work). Thanks.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: deleting out seconds from a date

    Depending on what you are doing with the dates, you may not need to strip the time out...what are you doing?

    You could use a helper column with this, to remove the time...
    =INT(cell-ref)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    09-30-2015
    Location
    LA my baby
    MS-Off Ver
    2013
    Posts
    727

    Re: deleting out seconds from a date

    I'm trying to create group by dates in a powerpivot. The first table has the dates formatted with minutes, the linked table that I created does not. I didn't understand cell-ref? Thanks.

  4. #4
    Registered User
    Join Date
    08-19-2014
    Location
    Dallas, TX
    MS-Off Ver
    Office2013
    Posts
    44

    Re: deleting out seconds from a date

    Assuming 1/1/2016 12:30:00 PM is in A1:

    =TEXT(A1,"m/d/y hh") ========> 1/1/16 12
    =TEXT(A1,"m/dd/yyyy hh") =====> 1/01/2016 12
    =TEXT(A1,"mm/yyyy") ========> 01/2016

    But now your dates are text and will not match to dates that are actually date-formatted numbers. Easiest thing to do would be to format both as TEXT (using the same formatting mask) and THEN comparing the text strings.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: deleting out seconds from a date

    Quote Originally Posted by stephme55 View Post
    I'm trying to create group by dates in a powerpivot. The first table has the dates formatted with minutes, the linked table that I created does not. I didn't understand cell-ref? Thanks.
    I am suggesting that in your data table, you create a helper column and use the INT() function top strip out the time. I used Cell-Ref to indicate the cell that would contain the data.
    If the data starts in A2, then =INT(A2)
    If the data starts in B3, then =INT(B3)
    etc

    You wiould then use that column in your PT instead of the date/time column
    Last edited by FDibbins; 06-18-2016 at 12:06 AM.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: deleting out seconds from a date

    Quote Originally Posted by XLPadawan View Post
    Assuming 1/1/2016 12:30:00 PM is in A1:

    =TEXT(A1,"m/d/y hh") ========> 1/1/16 12
    =TEXT(A1,"m/dd/yyyy hh") =====> 1/01/2016 12
    =TEXT(A1,"mm/yyyy") ========> 01/2016

    But now your dates are text and will not match to dates that are actually date-formatted numbers. Easiest thing to do would be to format both as TEXT (using the same formatting mask) and THEN comparing the text strings.
    It is almost always better to leave dates as dates, that way you can use 1 of the many date functions built into excel. If you convert them, you may need to convert them back afterwards, a potentially unnecessary extra step

+ 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. Get date as a number in seconds
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2015, 04:40 AM
  2. Replies: 4
    Last Post: 04-30-2014, 12:42 PM
  3. Addition of Seconds with Date
    By rcmanivannan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2013, 08:30 AM
  4. convert from seconds to form hours: minutes: seconds?
    By nguyen_han in forum Excel General
    Replies: 2
    Last Post: 10-13-2011, 06:56 AM
  5. Replies: 4
    Last Post: 01-18-2010, 04:29 AM
  6. Converting seconds to the excel date value.
    By taji in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-26-2007, 07:48 AM
  7. [SOLVED] Converting Julian Seconds with a macro to replace old seconds data
    By Keldair in forum Excel General
    Replies: 2
    Last Post: 02-17-2006, 08:15 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