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

Add minutes to a current time

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
2 25804
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Chris | last post by:
Sorry, This should be simple, but brain is hurting... How do I convert a Current Time to a Decimal 6,0 (HMS)? There must be a cleaner way then this: Insert into Table Values Dec(...
2
by: MarthaR | last post by:
I am trying to add the current time to a field when the user clicks on the toggle button next to the field. I am getting a time of 12:00:00 AM each time I click the button. How do I get a...
18
by: Tim Quon | last post by:
Hi I need to print the current time. I found an example where this is done as followed: long *mytime; time(mytime); printf("time: %s", ascitime(mytime); But this doesn't work and prints...
3
by: | last post by:
I have a datetime field in table. I want to insert the current time of database server to the table thr ASP.NET (C#). I have dataset to do the insert: DataSet1.TableNameRow rowNew =...
4
by: Gary Wessle | last post by:
Hi I am not getting current time with this program, what am I doing wrong? #include <ctime> #include <iostream> using namespace std; #define P(x) cout << #x " = " << (x) << "\n";
0
by: Saloni | last post by:
I have windows service which is going to run on several machines which are in different time zones in USA. I want to find out the Eastern Zone current time from these different machines. It...
3
by: Mark Ingram | last post by:
Hi, I'd like to know the best way of checking the current time during a demonstration product. At the minute i store the first run date, then compare that to the system time, but obviously a user...
4
by: iwdu15 | last post by:
Hi, in VB i could use the keyword Now to get the current DateTime, but C# doesnt have that. How can i get the current time? thanks -- -iwdu15
4
by: JuAn2226 | last post by:
Hi, can anyone help me . when my program starts there is numbers and time will be display in the form of visual basic. it will run continuesly .My problem here is i dont know how to display the data...
2
Rozeanna Jerry
by: Rozeanna Jerry | last post by:
Hi every one..I am trying to add 8 hours 15 minutes to current time and show the new time on a text box. How would I do that.? For example if the current time is 8:00am then adding 8 hours 15...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.