Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subtract hours& minutes from Date/Time is it possible

Status
Not open for further replies.

kiwieur

Technical User
Joined
Apr 25, 2006
Messages
200
Location
GB
Hi,

Is it possible to subtract hours and minutes from a date/Time field for example

subtract 40 mins from 14/06/06 01:30

to get the result

13/06/06 23:50

Regards

Paul
 
No it's not because you would actually need to subtract 1 hour and 40 min :-)

Assuming your dater/time was in A1 then in any other cell:-

=A1-TIME(1,40,0)

You can have the 1 nad the 40 etc in their own cells and reference those cells if you prefer.

Regards
Ken...............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Ken,

Thank you for your reply, another question if i may

what if i wanted to subtract 4 days from 14/06/06 01:50

to get the result

10/06/06 01:50

is this possible

Regards

Paul
 
Hi Paul,

you may want to read this FAQ to learn more about dates and times .... faq68-5827

In the meantime, dates are held as the integer part of the date/time serial, i.e. a day = 1. So to subtract 4 days from a date/time, just subtract 4 from it.

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top