+ Reply to Thread
Results 1 to 10 of 10

Split date and time stamp

  1. #1
    Registered User
    Join Date
    07-12-2011
    Location
    Kildare,Ireland
    MS-Off Ver
    Excel 2010
    Posts
    59

    Split date and time stamp

    Hey folks,
    Tried searching and couldn't find the answer I was looking for...

    I have a date and time stamp which is system generated, I want to split these out so I can do analysis on date alone or time ect.

    The current format is 05/01/2012 16:49..

    Any ideas much appreciated, also, is it possible to use a formula that will tell me the week number??

    Cheers
    Dave

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Split date and time stamp

    hello
    =INT(A1)Format as a date

    =MOD(A1,1)Format cell as time
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Split date and time stamp

    Hi

    One way, could be this


    1. =int(A1), format as date
    2. =MOD(A1,1), format as time
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Split date and time stamp

    week number with/out analysis tool pack installed
    =INT((A1-DATE(YEAR(A1),1,1)-WEEKDAY(A1))/7)+2 - sunday first day
    =INT((A1-WEEKDAY(A1,2)-DATE(YEAR(A1+4-WEEKDAY(A1,2)),1,4))/7)+2 - monday first day

    with analysis tool pack use
    =weeknum(A1)

  5. #5
    Registered User
    Join Date
    07-12-2011
    Location
    Kildare,Ireland
    MS-Off Ver
    Excel 2010
    Posts
    59

    Re: Split date and time stamp

    Thanks folks, just found the weeknum tool there too!

    Great site!

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Split date and time stamp

    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Split date and time stamp

    your welcome from us.
    @Fotis, i noticed that too.lol.let's split te price.

  8. #8
    Registered User
    Join Date
    07-09-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Split date and time stamp

    Assuming your timestamp is in column B and is in the format m/d/yyyy hh:mm:ss then procede as follows.
    Add two column's (assuming that the timestamp's actually referencing the data you want to use).
    In the now column C "=INT(B(row in question))
    In column D "=B2-C2"
    Format column C as date
    Format column D as time.

    Regards

    Dougie

  9. #9
    Registered User
    Join Date
    10-08-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    1

    Re: Split date and time stamp

    as shown above:
    =INT(A1)Format as a date

    =MOD(A1,1)Format cell as time
    This method actually does not work for times ending in zero.

    If the time is 7:40am using the mod(A1,1) fomula will give you 7:04am. Although as stated below in this thread pulling out the date with the Int(A1) and then subtracting it from the date/time variable does result in the correct time. But I had to figure this one out the hard way!
    Last edited by RaeStat; 10-08-2014 at 03:09 PM. Reason: message wasn't linked to the initial post I was responding to

  10. #10
    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
    53,048

    Re: Split date and time stamp

    Raestat, thanks for the input, but this thread is over 2 years old, I doubt anyone is still following it.

    and just FYI...
    =MOD(A1,1)Format cell as time
    This method actually does not work for times ending in zero.
    not so, I just tested it and it worked fine
    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

+ 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