By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,186 Members | 1,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,186 IT Pros & Developers. It's quick & easy.

Add minutes to a current time

P: n/a
Hi,

I am with C#(V1.1).

How to add only minutes to a current system time in C#.

Suppose My system time is 16:28:09.28(Type time at command prompt)

I need to add 1 minute to a this time :

My output should be 16:29:09.28

Please help.

Thans in advance.

regards
*** Sent via Developersdex http://www.developersdex.com ***
Mar 29 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Wed, 29 Mar 2006 03:04:05 -0800, Kondapanaidu wrote:
Hi,

I am with C#(V1.1).

How to add only minutes to a current system time in C#.

Suppose My system time is 16:28:09.28(Type time at command prompt)

I need to add 1 minute to a this time :

My output should be 16:29:09.28

Please help.

Thans in advance.


Get the current DateTime by calling the static DateTime.Now() method. Add
1 minute by call AddMinutes on the returned DateTime object, passing 1 as
the parameter.

Did you even look at the MSDN documentation, this is simple stuff?
--
Tom Porterfield
Mar 29 '06 #2

P: n/a
Hello sir! Here you go:
________________________
DateTime oneMinuteFromNow = DateTime.Now.AddMinutes(1);
string output = oneMinuteFromNow.ToString();
________________________
Your output would look similar to:
3/29/2006 6:20:44 AM

You could also change this by using the different properties of the DateTime
class.
________________________

"Kondapanaidu" wrote:
Hi,

I am with C#(V1.1).

How to add only minutes to a current system time in C#.

Suppose My system time is 16:28:09.28(Type time at command prompt)

I need to add 1 minute to a this time :

My output should be 16:29:09.28

Please help.

Thans in advance.

regards
*** Sent via Developersdex http://www.developersdex.com ***

Mar 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.