473,385 Members | 1,449 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,385 software developers and data experts.

Shool project. Need help please!...

Hello! I had a quick question regarding an issue I've been having with this question...how would I make a value in minutes -for instance 197 mins- show in hour and minute format -as 3 hours and 17 minutes-. Thanks in advance!
Sep 15 '08 #1
2 1108
Curtis Rutland
3,256 Expert 2GB
Here are two good links:
http://msdn.microsoft.com/en-us/libr....timespan.aspx
http://blog.stevex.net/index.php/str...ing-in-csharp/

You can use a TimeSpan to define a certain amount of time. Look at it's static methods that return a TimeSpan from certain units of time, like TimeSpan.FromDays.

Then, you can use String.Format to display the time properly. Scroll down to the Dates section of the second link.

Hope that helps.
Sep 15 '08 #2
balabaster
797 Expert 512MB
Also, there's an alternative mathematical approach using the mod operator. Mod will give you the remainder of a division.

i.e. 197 mod 60 = 17

...and the \ operator (not to be confused with /) will give you the integer part of a division.

197 \ 60 = 3

197 / 60 = 3.28333....

So you could figure out hours and minutes in two parts:

Hours = 197 \ 60
Minutes = 197 Mod 60

So there ya go... plus, this method will probably score you more points for actually understanding how to calculate it manually rather than having the computer do it for you. A little theory seems to go a long way in class.
Sep 15 '08 #3

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

Similar topics

8
by: Paul | last post by:
Hi all may I know how to use C# DLL inside my VC++ Project ? Thanks in advance.
4
by: Stephen Miller | last post by:
Hi, I am running v1.1.4322 on Win2K server and unable to debug a ASP.Net application running locally, using a full URL (ie www.mysite.com). When I hit F5, I get the following error message: ...
4
by: Brad | last post by:
I'm not one to rant or flame....so please excuse me while I do so for this once. I've now spent a bit of time working with VS2005 beta 2 to see how it functions for web development, especially how...
3
by: uday.das | last post by:
hi , I am not sure but I think it might be to avoid heap fragmentation due to several malloc calls. Are there any strong reason ? What are the other things that should take care when we implement...
4
by: g4356 | last post by:
Hi, A new baby question: I downloaded a dot net project and saved it to my local disk. When I tried to open this project, a message popped up: "Unable to open web project "test/myfirstweb"/ The...
3
by: CJM | last post by:
I'm trying to create a new web project (ASP.NET) on VS2005, but when I click on New Project I don't get offered the option of creating any type of web project. It offers me both VB.NET and C#...
12
by: docschnipp | last post by:
I have moved a project from VS2003 to VS2005 and now all references point to ..NET2.0 libs. How can I change this back to 1.1, but still use VS2005? I need this for compatibility reasons. ...
13
by: Matt Fielder | last post by:
First off, if this is better posted in another group that qualifies as a manged group, please let me know. I currently have an application written in VB.Net using MSDE as the database. Current...
3
by: Nick Gilbert | last post by:
Hi, In my VS.NET 2005, if I choose Build Clean Solution, the BIN folder is not touched. Shouldn't it delete all the dll and pdb files in that folder first? Instead, I'm finding I have to do it...
24
by: =?Utf-8?B?RHIuIFMu?= | last post by:
I am incorporating three existing programs into a new "all in one" program. I have added the three projects to the new all in one project. How do I instruct the new initial menu to launch the main...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.