Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2007, 02:35 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
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......
 
Old October 9th, 2007, 03:56 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
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 -/
 
Old October 9th, 2007, 07:29 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

thanks a lot i tried first one it is working.

thanks......





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.