473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to convert a time to minutes

hi

I have a time field in short time format and I want it to convert to minutes and add a time in minutes for it and calculate the total time in hours and minutes. can anyone help me?
May 17 '18 #1
2 1738
twinnyfo
3,653 Expert Mod 2GB
Hashinimoses,

Welcome to Bytes!

The simplest method I can think of is to use the DateAdd() Function, using “n” as the interval. You can review all teh syntax in this MS Office Article.

Hope this hepps!
May 17 '18 #2
NeoPa
32,556 Expert Mod 16PB
HashiniMoses:
I have a time field in short time format
No. You really don't. You have a Date/Time field (Full stop). How it's formatted when you display it is no part of this question. It's simply confusing you into thinking about it the wrong way.

So, you have a Date/Time value, that presumably has no date component, and you'd like to add x number of minutes to that. You may even desire to show the result as a Time (in Short Time) format.

Of course TwinnyFo is on exactly the right lines. I wanted to try to ensure you not only got an answer, but that you also let go of the wrong-thinking that caused you to be confused in the first place.

So, assuming the variable you start with is datVar, and the number of minutes you want to add is intVar, then you could say :
Expand|Select|Wrap|Line Numbers
  1. datVar = DateAdd("n", intVar, datVar)
To display this as a Short Time (Be careful as this is modulo so won't show correctly if the value exceeds 24 hours.) :
Expand|Select|Wrap|Line Numbers
  1. Debug.Print Format(datVar, "HH:nn")
May 17 '18 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: tony | last post by:
Hello! I have this method ConvStdTimeToSec here that convert format hh:mm:ss into total number of seconds and return it. I just wonder if there exist a metod in the .NET framework that can be...
2
by: windsorben | last post by:
Can anyone show me the javascript to do this and submit it to a form called "my form" and a field called "time"? Also, let me know if I need to put anything in the "body" to start the timer. ...
3
by: fmjoiner | last post by:
I have the code to convert a string into a int (the atoi function) but it only gives me the first number say if the time is 6:23:08 it only returns the number 6 but I need to change all of this to...
1
by: davelist | last post by:
I'm guessing there is an easy way to do this but I keep going around in circles in the documentation. I have a time stamp that looks like this (corresponding to UTC time): start_time =...
5
by: rouven | last post by:
Hi, i am trying to convert that time format '05:26:40 Jun 19, 2007 PDT' into mysql compatible format like YYYY-MM-DD HH:MM:SS. the code i tried was: from datetime import datetime from time...
0
by: dhanu sahu | last post by:
Hello friends, I am trying to convert datetime into integer, Ex- In dropdownlist 1- 9:30AM In dropdownlist 2- 6:PM I want total time as Thour=9:30AM-6:00PM,
2
by: nabil035 | last post by:
hi, wel I have these vars: double day,month,year,hour,minute,second,millisecond; I want to convert this data to a filetime structure, I don't want of course to convert them manually ...
1
by: mdthom08 | last post by:
I can't figure out the formula to convert military time all to minutes.
1
by: dougancil | last post by:
I have the following sql query: SELECT .name, .Employeenumber, Convert (-(/1000)/60))/1440+1,"mm/dd/yy"as , FROM Employees INNER JOIN mOpInterval ON .Loginname1 = mOpInterval.Opname The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.