.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How can i show the seconds in the timer as minutes and seconds?

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :Windows Application

Im using a timer to countdown seconds. The value of the int is 1200000.

Instead shoing 1200000 and then 1199999

I want to show it as minutes and seconds.

Not the same format like DateTime.Now but something like that a forma that will show minutes and seconds and that will count the seconds back and when a new minute so it will count one minute down and so on.

Like: Minutes left: 7 Seconds: 55 for example.


This is the timer code where i want to show better format:




View Complete Post

More Related Resource Links

Show busyindicator always for 3 seconds


I am showing the busy indicator in my WPF code below when loading grid. sometime busy indicator won't appear it server returns fast. I wanted to show the indicator always for first 3 seconds when a button clicked. How to do this?


      <extToolkit:BusyIndicator IsBusy="True" BusyContent="Loading... Please wait" x:Name="BusyIndicator1" IsTabStop="False" Focusable="

can anyone tell me why setInterval is not working properly i want to display the time every seconds,

setInterval is suppose to execute the script every second there getting the most uptodate time of day , but it does not update it stays the same
      <script type="text/JavaScript">

          function interval() {
              setInterval("time()", 1000);
          function time() 
              var d = new Date();
              var time = d.getHours();
              var time2 = d.getMinutes();
              var time3 = d.getSeconds();

              document.write(" : ");
              document.write(" : ");
  // -->
      <input type="button" OnClick="interval()" value="Click Me!"/>


How to convert seconds to HH:MM:ss format

Write a C# program that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (for example, if the elapsed time is 9630 seconds, then the output is 2:40:30.)Can anyone pls help me!!Im using visual studio 2005

PollingDuplexHttpBinding Client Channel Faults unexpectedly after few seconds

Hello, i have a Silverlight 4 application which communicates using Http Polling Duplex to an IIS 7, .NET 4 WCF Service (actually two of them, in the same app). I am obviously taking advantage of the callback features provided by this type of solution. Setup has been performed by following these documents: Service setup: http://msdn.microsoft.com/en-us/library/cc645027%28v=VS.95%29.aspx Silverlight setup: http://msdn.microsoft.com/en-us/library/ee844557%28v=VS.95%29.aspx All has been working fine until yesterday, when i went on upgrading the Silverlight Tools for VS2010 to version 10.0.30319.352 which has also upgraded my Silverlight runtime to 4.0.50826.0 . Running my app now, after few seconds from the first call to the services, the client inner-channel faulted event fires on both proxies without an apparent motivation (exception, user interaction, etc.). What i have been able to notice, by analyzing connections with Fiddler, is that as soon as the open connection to the service which holds a callback channel receives a response, the client-side proxies fail. I'll try to show how the HTTP connections appear to behave: Call to the first service, callback channel retreived, immediate response 200 OK, no content Call to the second service, business logic performed, immediate response 200 OK, no content Call to the first service, no response for a few seconds, response 200 OK

performance test: Sql profiler recorded 8 seconds but only far less than 1 seconds executed in Manag

hi, all. I used sql profiler to record the long running sql while doing performance test. The performance test simulated 100 curcurrent users. When the test finished, I catched  some long running sql(some are select sql and some are update sql) in the sql profiler and executed them in the Management Studio, all of them finished execution in less than 1 second. I am curious about this. I  know under 100 curcurrent users operation, both Operating System and Sql Server have less resource to execute a given sql, so I thought they would finish execution in about 2 or 3 seconds rather than 8 seconds. I did the same performance test again and during the test, i executed those sql in the management studio. I become even more curious. Thoes sql still executed in less than 1 second. Why? I am new to performance test. Please help me. Thank you.

Query execution time from 1 second in SQL 2000 to 20 Seconds in SQL 2008 R2


When I ran this query from SQL 2000 it takes 1 second. now in SQL 2008 R2  the same query is 20 times slower.

This is the query and the numer of records and the time in SQL 2008 R2:

SELECT * FROM dbo.CxP_Saldos 
0 seconds, 923 Rows
SELECT * FROM S_Conta.Cuentas
0 seconds, 662 Rows
SELECT * FROM S_Conta.Cuentas c INNER JOIN dbo.CxP_Saldos s ON c.id = s.CtaProv
18 seconds, 923 Rows

how can I submit the actual execution Plan?

Timeout Error - 30 seconds - When runing long Querys


Hello all,

I am having problems of Timeout on my Application using Ajax Toolkit, more precisely when runing long Querys on SQL Server.

I have tryed all solution that I found os forums like:

- change the AsyncPostBackTimeout os Toolkit ScriptManager.

- Set the CommandTimeout = 60000 of the SqlCommand.

- Add Connect Timeout on Connection String.

- Add <sessionState mode="InProc" timeout = "60000" sqlCommanTimeout="60000"> on webconfig

I'm testing with a query that run normally on ManagementStudio in 50 seconds approximately, but on Application breaks with this error bellow on 30 seconds. Occurs on any browser, runing from IIS or from VS, wherever...

I'm forgoting something?  please any help..


Mensagem: Sys.WebForms.PageRequestManagerServerErrorException: The timeout period elapsed prior to completion of the operation or

Removing seconds and milliseconds from datetime

I have a date that is formatted like so: 2010-09-01 00:15:46.00. What is the most elegant way to get the date and the hh:mm. I do not need seconds or milliseconds.

C# wait for x seconds

I need an app to wait for x seconds. How can I implement that?

convert hh:mm:ss to seconds


Hi i have a clolumn with values in HH:MM:SS format which is Varchar.

I need to convert them to seconds.In my column i have a row with value 51:03:20.i need to convert this to seconds.i tried using




threading timers fires few seconds before the actual due time



We're getting following problem while using system.threading.timer ( .net framework 2.0 ) from a Windows service.

There are around 12 different timer objects..
Each timer has due time and interval. This is set correctly.
It is observed that after 3 to 4 hours, the timers start signalling before their interval elapses. For example if the timer is supposed to signal at 4:59:59, it gets signalled at 4:59:52, 7 seconds earlier.
Can someone tell me what is the cause for this behavior and what is the solution for that ?

Thanks, Gayatri

Slow startup. Waiting for MEX data for 40 seconds.


Hi all,

I'm tearing my hear out, and I don't have that much hair left to start with.  I have a WCF program that takes 41 seconds to start. For 40 of those seconds it's sitting waiting for the MEX data.  It runs fine after that.  Here are the details:

  • Running on Windows 7, and I can't try it on another machine.  This is the machine it has to work on.
  • Compiled with Visual Studio 2010 with .NET 4.0 as the target
  • I'm not running in Administrator mode, and it doesn't help anyway, when I tried it. (And I can't imagine why anyone would do that, but that's another story!)
  • The endpoint is using the named pipes protocol, so I can't set "UseDefaultWebProxy = false".
  • I tried other protocols including the HTTP protocols and TCP.  It doesn't change anything.
  • I have no security set at all.
  • I added the <generatePublisherEvidence enabled="false" /> because I understand that can help if the lookup is searching for expired certificates.
  • I tried it with one base address -- for the named pipe; and with the current two base addresses.
  • While it's sitting there for 40 seconds waiting for the MEX data, my internet browser hangs.
  • Also, when looking at the trace I notice that before listening for MEX, it constructs a ServiceHost and the

Search in SharePoint 2010 does not show results for all users other than the timer service account


I have setup a new SharePoint 2010 setup. Created Search Service application and configured. Confirmed that the crawl went fine without any error for both Local site and a file share. In the Search application i confirmed that the All Site scope shows 3890 items.

ISSUE: If any of the user [including site collection administrator] browses the site and try to search something it does NOT show result [No error either it says We did not find any results for .....]. All Site scopes does not show 3890 items but only 28.

But if the timer service account [system account] logs in the site and does the search it works fine.With this account loggd in if i check the All Site scopes i do see 3890 items.

This does seems to be some thing to do with the permission, but i am not able to get hint where the mistake is.

I have done the follow till now.

> I checked the application association is correct
> Created a new web application and confirmed that the issue exists there as well
> Checked ULS log but dont see any error related to this.
> No relavent event id in Application event viewer

Please help

Regards Ram

How do I wait for 10 seconds before doing a response.redirect?

I want to wait for 10 seconds before doing a response.redirect("test.aspx") to another aspx page.

So how should I do it?

Calculating yrs, months, days, hours, mins, seconds between two dates. SQL


I'm trying to calculate the yrs, months, days, hours, mins, seconds between two dates with sql server or c# (ive just used sql more). 

I have some code below that I started, but I get some negative values for months, values over 31 for months, and there very well could be more issues. Honestly my math is not the greatest and Im just not sure how to fix it. I want the user to be able to enter their birthday and for it to calculate the yrs, months, days, hours, mins, and seconds they have been alive.

Any help would be great 


((DATEDIFF(MONTH,'10/16/1995',GETDATE()))-(DATEDIFF(YEAR,'10/16/1995',GETDATE())*12)) AS 'Months',
(DATEDIFF(DAY,'10/16/1995',GETDATE()))-(DATEDIFF(MONTH,'10/16/1995',GETDATE())*30) AS 'Days', 
(DATEDIFF(HOUR,'10/16/1995',GETDATE()))-(DATEDIFF(DAY,'10/16/1995',GETDATE())*24) AS 'Hours',
(DATEDIFF(MINUTE,'10/16/1995',GETDATE()))-(DATEDIFF(HOUR,'10/16/1995',GETDATE())*60) AS 'Minutes',
(DATEDIFF(SECOND,'10/16/1995',GETDATE()))-(DATEDIFF(MINUTE,'10/16/1995',GETDATE())*60) AS 'Seconds'

a few seconds wait


hi guys,

I am trying to write a site where you can download stuff. I would implement the following scenario:

1. user clicks on a download button

2. it redirects him to a new page

3. download will start but after a few seconds (the number of seconds left will be displayed).

how to make the last bit, how to start download after a few seconds and also put this info in a label?

thanks in advance

How to Redirect a page after x seconds



I am tring to redirect but somehow it doesnt work.

I want to redirect a user after x seconds.

Here is what I am trying:

<asp:Panel ID="pnlRedirect" runat="server" Visible="false">
    <head><meta http-equiv="refresh" content="10;url=submit.aspx?id=-1"/></head>

Tried also rediect on codebehind, with sleep method, on PageLoad, but then, the page doesn't show...so maybe I can put this code on another page life cycle method?

Please help,


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend