Click here to Skip to main content
15,893,588 members
Everything / Time

Time

time

Great Reads

by Graham Wilson
An exercise to measure the drift in the time-of-day clock on a Windows PC using the periodic timer
by honey the codewitch
Create a simple synchronized analog clock using GFX, and a bit of code
by Keith Barrow
If you have a Winforms application that auto loads data, there is no doubt that you’ll have come across the problem of data loading at design time (i.e. when opening the code in the designer). At best, this slows the designer down, at worst it might crash VS and prevent the control from...
by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.

Latest Articles

by honey the codewitch
Just a clock with snazzy digits that syncs using NTP and gets your timezone from your IP.
by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.
by honey the codewitch
Create a clock that uses multiple Internet services to detect your weather, date and time
by honey the codewitch
Create a simple synchronized analog clock using GFX, and a bit of code

All Articles

Sort by Updated

Time 

10 Jan 2011 by #realJSOP
To determine the elapsed time, create two DateTime variables - one called started, and called stopped. When the players starts to play, set the started datetime with DateTime.Now, and when a collision occurs, set the stopped datetime.Since you're only displaying time as it passes,...
24 Dec 2011 by #realJSOP
Create a thread that checks for keyboard activity every X seconds. If the thread doesn't detect activity, do something. When the user kits a key, set a value indicating the datetime of the activity. This is the variable that the thread would check to see how long it's been since the last...
21 Jun 2018 by 11917640 Member
I need a way to manage a date, including milliseconds: get current date and time, add given number of milliseconds to it. The first part is completed. C++ version up to C++14. Thanks. Update: some background. I have a file with timestamp in the beginning, and number of records, each one...
7 Apr 2011 by 555336
Ok, I'm posting this again, I have a problem in timers, I want to display 3 forms each one after 3, 5 and 10 seconds, how to do that?I mean when the first form appears, after 3 seconds another one will appear, then after 5 seconds the second will appear and finally after 10 seconds the...
11 Sep 2014 by _Q12_
I have a video player that I want to build. i have a horizontal scroll bar lenghtMovieLoaded = video.Duration; //(Retrieves the length, in seconds, of the video file.)hScrollBar1.Maximum = (int)Math.Round(lenghtMovieLoaded); //maximum of scrollbarLets say, my video.Duration is 1000...
16 Jan 2013 by aasif iqbal
i think this will help You.. SqlConnection sqlconn = new SqlConnection("Data Source=AAN-PC;Initial Catalog=latestsensordata;Integrated Security=True"); SqlDataAdapter sa = new SqlDataAdapter(); string CurrntTime =...
12 May 2021 by Abeer Joshi
Yeah that helped me too, thanks everyone :)
18 Apr 2010 by Abhinav S
Have a look at this post here[^].It discusses various way to do this plus recommended practices.
7 Mar 2012 by Abhineet Ayan Verma
Hi All,I am writing a code to implement FTP Client-Server which have the methods for 1. Client Username-Password Authentication.2. Downloading A File.3. Uploading A File.Now the steps in which my code should work is:A. Server keeps in memory the Username-Password Pair.B. Each...
10 Nov 2011 by Addy Tas
I'm not familiar with streaming video but instead of finding a calculated bit rate i'd first check if i would get buffer notifications of the client. E.g. Buffer 80% like serial ports can provide. Calculating the play rate may lead to glitches in your video presentation depending on the...
23 Dec 2017 by Afzaal Ahmad Zeeshan
You can create a new calendar control using jQuery UI. Datepicker | jQuery UI[^] For the database, you can use the PHP helpers for your database providers. For example, for MySQL and PHP you can follow this tutorial; PHP and MySQL[^].
25 Nov 2013 by akamper
I've implemented a custom UITypeEditor. The UITypeEditor is a modal dialog and should open as a child dialog of my application.I've overriden the method EditValue, so i can show the dialog. The WindowsFormsEditorService handles the display of the dialog while in design time:public...
10 Apr 2014 by akhil.krish
how to add between time only late time select distinctE.USERID,Convert(date,LOCALTIMESTAMP) as ATTDate,(select min(Convert(TIME,TIMESTAMPS)) from access_event_logs As MINCE where CAST(MINCE.TIMESTAMPS as DATE)=CAST(E.TIMESTAMPS As DATE) AND MINCE.EVENTID ='In' and MINCE.USERID=E.USERID)...
18 Jun 2012 by Alan N
From your comment on Mehdi's answer I see that the task duration can be much greater than the timer interval and your original solution is OK for that situation.The problem is how to repeat a task, not every 500ms, but 500ms after the task has completed.You have the timer based solution...
18 Jul 2013 by Alan N
Yes I can see this jittering effect on my computer too, or to be more accurate I could when a programme was being recorded from the USB digital TV tuner. Now that has stopped and the tuner has been unplugged the timer is quite regular. I was seeing SignalTime intervals of either 15.625ms or...
17 Feb 2010 by Alaric Dailey
One thing that annoys me is huge companies that ignore time issues. Several of my clients have had huge networks across multiple timezones, and they wondered why logging times in the database were always off, everyone was logging in their local time, making it impossible to correlate logs. ...
20 Jan 2011 by Amit Kumar Tiwari
Check this link: http://classicasp.aspfaq.com/general/how-do-i-get-the-server-s-timezone-information.html[^]
2 Feb 2011 by Amit Kumar Tiwari
Please check this http://stackoverflow.com/questions/3849975/how-to-get-all-dates-in-a-given-month-in-c[^]
19 Jul 2010 by amit_upadhyay
i was trying to make a free microsoft word plugin in vb.net. It automatically fills a web form. The main problem with the plugin is that it uses web browser control and once it has filled a form it will need to navigate another form. The form can only be filled once it has completely been...
17 Aug 2012 by AmitGajjar
Hi,Hopeful...
2 May 2020 by anakinche
Friends i have in txtvolume of tank1 10000m3. i empty it with flowrate of 1000m3/h.Can i calculate the time it will be empty and the volume every minute? What I have tried: Several things but do not work i want you to help me if you can
5 May 2020 by anakinche
How do i calculate time between running live time from timer1 and a datetimepicker1.value? What I have tried: I do not know how to do this.I want your ideas.Thank you in advance!
3 Aug 2014 by Andreas Gieriet
See DateTime[^] and TimeSpan[^].You basically do not deserve such an answer since you should have found it yourself: google: C# time difference... Or do you have a good reason to not look this up yourself?Andi
10 Mar 2012 by André Kraak
Use the TimeZoneInfo Class[^] and one of its conversion functions.For example:TimeZoneInfo::ConvertTimeBySystemTimeZoneId( DateTime.Now, "W. Europe Standard Time" );
13 Apr 2013 by André Kraak
Use the DateTime.ToString[^] method.You can use the Standard Date and Time Format Strings[^] to get the time: DateTime.Now.ToString( "T" ) or the Custom Date and Time Format Strings[^]: DAteTime.Now.ToString( "HH:mm:ss" )
17 Sep 2011 by Anele Ngqandu
I want to create a clock on my ASP.NET page that display a time without refreshing the page
30 Aug 2010 by Ankur\m/
I guess you want to show a clock on your webpage.I could have written the script, but a Google search is always quick.So, Javascript to display time on Web page[^]how to show current time(ticking)[^]
22 Nov 2012 by Ankur\m/
Some suggestions:You may want to review the indexes on the tables used if the select is too slow. With proper indexes, even millions of records are returned in a few seconds.Secondly, you may want to reduce the amount of data that is returned if that is to be displayed to the user. As you...
30 Sep 2016 by AnkurJain14
I am trying to create a query in SQL Server 2012 to calculate time difference between First IN & Last OUT swipes for each employee(for normal day shift and night shift) in the company.Requirement are:Calculate regular shift punch First in / Last outCalculate night shift punch First in...
17 Jan 2017 by AnkurJain14
Hi All,I have a requirement where I have to generate a report using the below monthly data for each employee. The report runs every month(scheduled & adhocly) and provides data for last 1 month. The requirement is to divide this data in weekly data. So if Day of report run falls on...
19 Jan 2017 by AnkurJain14
I have a report in which i have to calculate overall worked hours by any employee in a week. The report reflects hours more than 24 hours(or 86400 seconds). I want to convert all the seconds into "00:00:00" format keeping the format of the columns as datetime or time so that I can do further...
13 Jun 2017 by AnotherKen
I would setup a variable to be of type System.DateTime then assign the datagridview cell value to it, then do something like variable = System.DateTime.Now - variable then I would assign it to the new cell location with something like datagridview1.row.cell[1] = variable.ToString();
15 Sep 2011 by Anup Das Gupta (asteranup)
11 Oct 2013 by ASP.NET Community
JavaScript sample to continuously display the current time on the web page. Continuously means that the textbox value will be updated with the
11 Oct 2013 by ASP.NET Community
The AdRotator control presents ad images that, when clicked, navigate to a new Web location. Each time the page is loaded into the browser, an ad is
11 Oct 2013 by ASP.NET Community
The Localize Control lets you localize any element on an .aspx page. It provides adesign time feature not offered by its base class, the Literal
11 Oct 2013 by ASP.NET Community
Since the dawn of asp.net, web based development has become a lot easier.  It provides a great deal of control over designs and code.  And affords
11 Oct 2013 by ASP.NET Community
Ever wondered what occurs when a user closes his browser window. For the time, the user was interacting with a site, his session was active and
11 Oct 2013 by ASP.NET Community
Response time is one of major factor in deciding the performance of web application. Many time we come across pages where content of page can be
11 Oct 2013 by ASP.NET Community
If you working in web development for a long time, you must have heard about knockout.js. It implements MVVM pattern in javascript. Siverlight guys
14 Jan 2014 by ASP.NET Community
What is a Preprocessor Directive?A preprocessor directive is a piece of code that is meant explicitly for the compiler.  This offers a programmer
11 Oct 2013 by ASP.NET Community
Every time user’s complaints me about page scroll issues. For example: If a lengthy page having a dropdown list with AutoPostBack = true at bottom of
11 Oct 2013 by ASP.NET Community
CachingAuthor: Prakash Singh MehraIntroduction: It is a way to store the frequently used data into the server memory which can be retrieved very
11 Oct 2013 by ASP.NET Community
ASP Image Control Enchanced with help of ScriptControl and javascript.When I've started working as a ASP.NET webdeveloper I was troubled by the
11 Oct 2013 by ASP.NET Community
While developing any web site, one should keep some points in mind.1) Set debug=false under compilation as follows:
11 Oct 2013 by ASP.NET Community
When working with an ASP.NET site that requires some sort of user authentication (almost every time, I'd say), we often need to establish our own
18 Oct 2013 by ASP.NET Community
Improve the scalability of a website and efficient design for time consuming processes.
19 Feb 2013 by ayyanan
Can any one send sample wcf project with some real time code and architecture of the project...
26 Feb 2015 by Bacanzela
How do I add a timestamp to a gridview that shows the last time a row was edited? I've been searching Google but haven't found anything helpful yet.I tried to create a method which will update the time when you edit or add a column. but i dont know how to take it further like parsing it to...
20 Jan 2011 by Baji Jabbar
Find the client IP first , and then the zone using IP addressHope there links will be helpful 1. Click here[^]2. Click here[^]
16 Jan 2013 by bapu_reddy
Pass the value datetime.now() value to time. Then it inserts a value along with current time.
24 May 2012 by bcsouter
I have an application that I need to run at a 10mSec rate (100hz) on a Windows 7/32 bit computer (that will also be running other applications at the same time). I know that windows is not an RTOS, but we are sort of stuck with a requirement to use it. This interrupt can have some minimally...
10 Jun 2014 by bhavikm20
Hi All couple of user facing **504 Gateway Time out** error when they are trying to download file from website. This time out error coming after exact 2 minutes of time. If user can download file before 2 minutes than it is working fine. I have check my local machine to put Thread.Sleep to...
9 Sep 2013 by BillWoodruff
I was about to post this a few hours ago, and then my computer crashed, and some business came up that had to be handled, but I'll post it anyway.I assume that when the OP says "take the amount of seconds from user, and my program will run for this amount of seconds," they mean they want to...
24 Jul 2012 by Blake Miller
Can't speak for Linux, but on Windows you can look into _gmtime_s and time and difftime Look in MSDN under the topic "Time Management".
19 Mar 2014 by bling
The value is in milliseconds so ... DWORD ticks = GetTickCount();DWORD milliseconds = ticks % 1000;ticks /= 1000;DWORD seconds = ticks % 60;ticks /= 60;DWORD minutes = ticks % 60;ticks /= 60;DWORD hours = ticks; // may exceed 24 hours.printf("%d:%02d:%02d.%03d\n", hours,...
1 Nov 2011 by BobJanova
How about having one timer for the class which is created when it's first needed?class MyCleverControl : UserControl { private static Timer timer; private static Timer Timer { get { if(timer == null) { timer = new Timer(TimerInterval); timer.Start(); } return timer; }...
11 Nov 2013 by Braydon
So I was coding my CMS for the updater well I am finished with the cod but I get the following error Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case...
2 Jul 2017 by Bryian Tan
You have 2 comma issues, one mentioned by @KornfeldEliyahuPeter Sum(MediumVal) As [Dine In], From Here is the other. As [MediumVal], FROM
7 Nov 2011 by Bun Leap_kh
hi,I have a problem with how to synchronize time. I need to send mail to recipients, and that mail must have specific time.here is my questions:- Does mail server or Web server automatically synchronize time?- If no, please tell me how to do this.Thanks
21 Mar 2013 by bunge-bunge
hI..I got a very simple question..i got my current time in "HH:MM:SS"formathow i 'm going to calculate the new time if i got a new value in second format.for example, my current time now is 16:36:30. I got 80 second and need to add this value to my current time.What is the simply way...
17 May 2017 by caf20012
Hi All, I'm having issues with my bejeweled bot picking up colors from my timer which is connected to a picturebox which is allowing me to select the rectangle based on the games location with the following code; Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles...
12 Dec 2012 by calincoosmin
Hello, i need to build an app that use a countdown (Years, Days, Hour, Minutes, Seconds). I've tried to write a code and i succeed to calculate the time, but when i try to put this time as a string in a texblock, he is not updating. Can anyone help me to set the textblock to update himself ?...
15 Dec 2012 by calincoosmin
I found the solution to my problem.void t_Tick(object sender, object e) { TimeSpan ts = endtime.Subtract(DateTime.Now); string countdowndays = ts.Days.ToString(); daytxtblk.Text = countdowndays; string countdownhours =...
31 Aug 2013 by CAS1224
Hello I have a vb.net program that uses excel as a datasource. I then fill a datagridview with this datasource and make changes to the dataset via the datagridview. I'm trying to find a way to refresh this dataset via a button that will update the values after a change. My only problem is that...
17 Mar 2011 by charles henington
Also.From MainFormmySecondForm frmSecondForm = new mySecondForm();frmSecondForm.ShowDialog();From Second FormTimer formCloser = new Timer();private void mySecondForm_Load(object sender, EventArgs e){ formCloser.Interval = 10000; formCloser.Enabled = true; ...
22 Sep 2011 by chenliangxu
Hi,maybe you can try function time() to get the system time.A simple example is shown as follows:#include #include using namespace std;int main(){ time_t tmpTime; time(&tmpTime); cout
20 May 2017 by CHill60
I had a go at this. As I said in my comment I hope this isn't homework as I found it quite difficult to get all of the information you wanted. The first problem to deal with is the missing information. The best way to handle that is to generate a sequence of expected entries e.g. SELECT...
10 Aug 2015 by ChrisCreateBoss
My project has a string setting named inHour, and in the main form the user is able to change that string, which is a specific hour and minute formatted this way: hh:mm tt.Now, let's say I have changed the default hour to 4:50 p.m. When real time reaches that string (by using...
22 Mar 2010 by Christian Graus
I guess you need to read the database that it logs to. Given that you used 'time' instead of the name of a language as your tag, I don't see how you can hope for more specific help, but either way, the best help you're likely to get is to be advised to read the manual that came with your...
20 Aug 2010 by Christian Graus
A time zone ? I believe it will just give you the time zone of your server and you need to convert that to GMT and to the desired timezone from there.
6 Jan 2013 by Christian Graus
Just output a :00 at the end, given that you don't have any info for seconds.Oh, I see. I assume you're string mashing, so use the Substring method to get the parts you need and insert the : and :00 you need.
1 Jun 2013 by Christian Graus
I would use a repeater, just because it will give you more control over how your time line is rendered. Then, just look at your data. Your data is all you can hope to show. You can show it any way you like, in a repeater.
4 Feb 2023 by Christian Torrico
Hi,i wanted to ask if there was some way to get the server date from a Microsoft Access database.I know about Date() and Time() methods, but in SELECT they give me local time. Can you give some help with this?
11 Aug 2014 by coded007
You can use Time data type to store type. For Testing use below queryUSE MasterCREATE table #t1(TT time)Insert INTO #t1 VALUES(getdate())SELECT * FROM #t1Drop table #t1
17 Jun 2012 by coffeenet
Hi,I am trying to build a project on Linux via Makefile.I keep getting cannot find error.I asked around, and I was told that my project doesn't have access to library folders.Therefore, I am trying to solve this problem by using the time library locally inside my project's folder.I am...
1 Oct 2013 by contracting1990
I have a default time "00:00:00" and I have a loop where I need to cumulatively add Time to it.for example first loop I have duration "00:00:38" I need to add it to "00:00:00" then in next iteration I need to add to it new duration "00:00:26" so output will be "00:01:04".Im building...
7 Apr 2011 by CPallini
You have to show the first form when iCount is equal to 3 (assuming your timer having period of 1 sec), the second one when it is equal to 5, the third one when it is equal to 10.:-)
12 Apr 2013 by CPallini
Roughly speaking, I would first normalize the amplitude of the two graphs and then time-translate one of them until best superposition is reached.
16 Dec 2013 by CPallini
I would use just one timer and a state machine[^] inside the tick event handler.
11 Sep 2014 by CPallini
int total_seconds = 1000;int hours = total_seconds / 3600;int minutes = total_seconds / 60 % 60;int seconds = total seconds % 60;
21 Jun 2018 by CPallini
I would Throw away the get_local_date function. Make a time_point_to_timestamp function. Make a timestamp_to_timepoint function. Implement add using the above functions and the time_point::operator+=.
19 Apr 2021 by CPallini
Consider algorithm 1: there is a statement executed (m*n) times, namely 𝑠𝑢𝑚 = 𝑠𝑢𝑚 + 𝐴[𝑖] Other statements are executed once (e.g. 𝑠𝑢𝑚 = 0;), so, for big values of n and m, their contribution is negligible. Therefore you may write...
11 Apr 2022 by CPallini
The big O doesn't give the exact time of execution. See, for instance Big O notation - Wikipedia[^] (Properties sections, multiplication by a constant).
14 Feb 2013 by CS2011
If you mean adding two dates this will help System.DateTime today = System.DateTime.Now;System.TimeSpan duration = new System.TimeSpan(36, 0, 0, 0);System.DateTime answer = today.Add(duration);System.Console.WriteLine("{0:dddd}", answer);you can find more details about this in...
29 Jan 2012 by cutexxbaby
i have a gridview and inside i have a TimeSelector, but how am i going to retrieve the time from the gridview cause if normally it is a TextBox we will use this Dim rbSelect As TextBox = DirectCast(GridView2.Cells(1).FindControl("TextBox"), TextBox)so how should i retrieve the time...
10 Jan 2011 by Dalek Dave
As John says, you can use a DateTime.Now to also run a time elapsed.Use this as a metric at the end of the game to show points per minute etc.Just set several variables and you can run events off them without using a timer.
15 Aug 2011 by dan!sh
I see you are using timer from System.Timers namespace. You have not written the Elapsed event handler yet. You have written Tick event handler which comes with System.Windows.Forms.Timer class.I guess you are new to .Net or C#. So I would suggest reading a book or two and then proceed.
1 Jun 2013 by Dao Van Manh
I am going to create a timeline to display the tasks/actions that are going to be completed in the next day..but I don't know, please help me!
10 Oct 2011 by Dave Kerr
This is not a very detailed question - can you explain a bit more - is this your own code which is timing out? A value of 60 seconds is very long, the timeout is occuring almost certainly because a failure of the backend - we need more detail in the question.
13 Jul 2014 by Dave Kreskowiak
Well, the function you found, SetCalendarInfo[^], says this in the documentation:Quote:This function only affects the user override portion of the calendar settings. It does not set the system defaults.The real question is WHY are you trying to modify the system calendar type? This is...
24 Jun 2017 by Dave Kreskowiak
Well, yes. But, a Timer is the easiest way to go. If you code is "slow", not using a Timer isn't going to fix anything. The problem isn't with your Timer but with something else in your code. Start with profiling your code to see where the bottlenecks are.
21 Nov 2020 by Dave Kreskowiak
That's not going to happen on Windows. You cannot get that kind of precision on a shared system that is not a real-time O/S. Events like that are guaranteed to happen NO SOONER THAN SCHEDULED. That does not mean exactly as scheduled.
18 Feb 2011 by David Thielen
A basic introduction to handling time
30 Sep 2016 by David_Wimbley
So here is one way of getting your results. Thanks again for posting schema and sample data. Made this very easy to help you.So for these two items, should be the DiffHours column that provides this dataQuote:Calculate regular shift punch First in / Last outCalculate night shift punch...
20 Jan 2011 by Davids Sukamanga
How do I set up an ASP Page so it displays the time as well as the zone?
10 Apr 2014 by dhaval_shah_IT
Hello,It is said that we should create functions that execute a specific action.My question is that does doing so increase execution time?Thanks,Dhaval Shah
1 Jun 2011 by dnisha03
Try this link,http://webnetrevolution.blogspot.com/2011/04/display-current-time.html[^]
30 Dec 2022 by DoingWork
I am reading LastBootUpTime by following method but it displays few days old time while I shutdown my PC on daily basis. I know the solution described in this link Windows 10 LastBootUpTime not updating[^] but enforce each user to change system...
2 Mar 2016 by DotNetSteve
Check out this js library:Moment.js | Home[^]andMoment Timezone | Home[^]