Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 9th, 2007, 03:35 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 232
Thanks: 0
Thanked 1 Time in 1 Post
Default to add three seconds

hello
i want to add three seconds in time span
i am using following syntax

TimeSpan RecordingStartTime = DateTime.Now.TimeOfDay;

what syntax i write to add three seconds.

thanks......
__________________
thanks......
  #2 (permalink)  
Old October 9th, 2007, 04:56 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,133
Thanks: 1
Thanked 189 Times in 188 Posts
Default

There are two ways of doing this.

1) Add 3 seconds to the DateTime before you get its TimeOfDay:

Code:
TimeSpan RecordingStartTime = DateTime.Now.AddSeconds(3).TimeOfDay;
2) Add a new TimeSpan to the TimeSpan:

Code:
TimeSpan RecordingStartTime = DateTime.Now.TimeOfDay;
RecordingStartTime.Add(new TimeSpan(0,0,3));
Reading the documentation for the TimeSpan object should have given you this information.

/- Sam Judson : Wrox Technical Editor -/
  #3 (permalink)  
Old October 9th, 2007, 08:29 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 232
Thanks: 0
Thanked 1 Time in 1 Post
Default

thanks a lot i tried first one it is working.

thanks......
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
wait for seconds pzmrcd C# 1 August 1st, 2007 03:06 PM
seconds-from-duration outspaced XSLT 2 April 3rd, 2007 09:51 AM
how to let the page holding for a few seconds walgr2k ASP.NET 2.0 Basics 1 May 19th, 2006 02:55 PM
Converting Seconds into Nano seconds and viceversa chandu80 General .NET 0 June 4th, 2005 02:18 AM
redirect after 2 seconds groupmatch BOOK: ASP.NET Website Programming Problem-Design-Solution 3 October 26th, 2004 05:44 PM



All times are GMT -4. The time now is 12:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.