+ Reply to Thread
Results 1 to 24 of 24

Adding 10 minutes to current time - issue at midnight

Hybrid View

thorne_ Adding 10 minutes to current... 05-11-2009, 06:03 AM
royUK Re: Adding 10 minutes to... 05-11-2009, 06:16 AM
thorne_ Re: Adding 10 minutes to... 05-11-2009, 06:21 AM
DonkeyOte Re: Adding 10 minutes to... 05-11-2009, 06:38 AM
thorne_ Re: Adding 10 minutes to... 05-11-2009, 06:53 AM
DonkeyOte Re: Adding 10 minutes to... 05-11-2009, 07:20 AM
thorne_ Re: Adding 10 minutes to... 05-11-2009, 07:42 AM
DonkeyOte Re: Adding 10 minutes to... 05-11-2009, 07:45 AM
thorne_ Re: Adding 10 minutes to... 05-11-2009, 08:12 AM
  1. #1
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding 10 minutes to current time - issue at midnight

    I'm not entirely sure I follow... but

    B2: =MOD(FLOOR(A2+"00:10","00:05"),1)

    Where A2 holds time to which 10 minutes are added, the prior 5 minute point will be returned... the MOD will handle the midnight issue... ie if A2 is 23:56 B1 would return 00:05

  2. #2
    Registered User
    Join Date
    05-11-2009
    Location
    dublin,ireland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding 10 minutes to current time - issue at midnight

    thanks for your reply, but it wont return the correct date-time will it?

    eg using todays date (11 may) at 23.51 it should return '2009-May-12 00:00:00'

    and does but at 23.55 it returns '2009-May-11 00:00:00'

    which is a problem

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding 10 minutes to current time - issue at midnight

    It's still difficult for me at least to visualise your setup... if you're trying to find the last 5 minute period for NOW + ten minutes then:

    =FLOOR(NOW()+"00:10","00:05")

    (NOW() is a DateTime value so you merely need to add ten minutes to it and adjust thereafter - the result of which will equally be a DateTime value, the Day portion will adjust as it crosses midnight)
    Last edited by DonkeyOte; 05-11-2009 at 07:23 AM.

  4. #4
    Registered User
    Join Date
    05-11-2009
    Location
    dublin,ireland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding 10 minutes to current time - issue at midnight

    again thanks for your reply, that works for 23.55 - 00.00 but before that (from 11.50) it returns one day too much

    eg @ 23.51 it return 2009-May-13 00.00.00

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding 10 minutes to current time - issue at midnight

    post a sample file... I can't comprehend how you're getting 13th May based on NOW() + 10 mins.

  6. #6
    Registered User
    Join Date
    05-11-2009
    Location
    dublin,ireland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding 10 minutes to current time - issue at midnight

    hi,

    I attached a sample - the left values are yours, the right values are what is there currently.

    i replaced several parameters with constants and made the updatetime = now()
    Attached Files Attached Files

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding 10 minutes to current time - issue at midnight

    No doubt I sound like a bore but can you explain each cell - I can't make head nor tail of it I'm afraid...

    Re:
    G5: =ROUND(FLOOR(NOW()+"00:10","00:05"),0)

    By Rounding to 0 decimals you are dispensing with Time altogether and using only a Day value. In XL dates are Integers and Time is Decimal... ie Noon on 11th May = 39944.5
    (the above value for today noon assumes 1904 Date System in Use)

    If you round to nearest whole number (ie 0) you dispense with time... going back to your original point re: 13th May ... if the time portion of the value pre-rounding was >= noon you will end up rounding up to the next day given 0.5 (noon) will round to 1 where 1 equates to 1 entire day... if the time were < noon then it would round down to 00:00 of the same day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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