Click here to Skip to main content
15,893,644 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 Title

Time 

6 Jan 2011 by mkowlowitz
5 F-A-Qs regarding project management and project management software
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...
29 Sep 2014 by ilostmyid2
my computer is connecting to the internet via a proxy server. i want to keep Windows 7 time accurate in such a condition. how can i?
29 Sep 2014 by Tim Carmichael
Setup NTP on the proxy server to sync with the wider world and tell the isolated machine to use the proxy for NTP service.
4 Jul 2015 by ilostmyid2
HiIn Windows 7, I'm using a proxy server to browse the internet. It just routes http packets. I need to keep the Windows time accurate and synced with global time servers.What's my best solution?Thanks
23 Mar 2016 by Luiey Ichigo
Hi all,I'm having a little confuse here. I'm writing code in Node-RED for saving data into MSSQL. Other data successfully save except "TIME".I set dt_Time in MSSQL with "time(7)" and when I make the default value to (GETDATE()) it will appear e.g. "13:52:06.0030000"I have tried...
23 Mar 2016 by Luiey Ichigo
Sorry, I just found the way to do it.I was weird why it be like that:-msg.query = "INSERT INTO dbo.Power ([dt_Date],[dt_Time]) VALUES('" + curr_date + "','" + curr_time + "')";
26 Dec 2012 by janprasil
Hello,I got a VB.NET script which makes a PDF document signed. It means - insert a signature and a timestamp. But the final document is not verified and it shows that the signature is not valid: "this document has been altered or corrupted"Here is the code:certificateData =...
26 Dec 2012 by Zoltán Zörgő
Is the signer root certificate installed in windows? Is the Windows Certificate store trusted by the Pdf viewer? Supposing Acrobat, see this article: http://blogs.adobe.com/security/2008/08/setting_signature_trust_in_ado_2.html[^] (the settings described there are still valid)
14 Jan 2017 by Graham Wilson
An exercise to measure the drift in the time-of-day clock on a Windows PC using the periodic timer
15 Feb 2014 by kool15th
I have a application which saves date and time into sql server 2008 database, than those values are fetched within the selected time range i.e, from Date and To date. The query searches into database that if today's date lie between the selected date range, if yes than perform task.The issue...
15 Feb 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
DateTime dt = this.dateTimePicker1.Value.Date;But this will also contain default time that is 12:00 AM as it is a DateTime Object.Otherwise you have to convert to string.
15 Feb 2014 by OriginalGriff
DateTime objects in .NET always have a time - they are stored as a number of milliseconds since an arbitrary point in time, so there is no way to have a DateTime without the Time unless you create a custom class.However, SQL does have a Date type which does not include the time. You could...
15 Feb 2014 by Gitanjali Singh
Try by setting CustomFormat// Set the Format type and the CustomFormat string.dateTimePicker1.Format = DateTimePickerFormat.Custom;dateTimePicker1.CustomFormat = "yyyy/MM/dd";Refer:http://stackoverflow.com/questions/1138195/get-date-from-date-time-picker[^]Hope this will work.
15 Feb 2014 by Krunal Rohit
First convert the date in string and give it a format as per your need and the convert it back to DateTime. See,String to DateTimeString MyString; MyString = "1999-09-01 21:34 PM"; //MyString = "1999-09-01 21:34 p.m."; //Depends on your regional settings DateTime MyDateTime;...
16 Jun 2022 by honey the codewitch
Create a clock that uses multiple Internet services to detect your weather, date and time
8 Sep 2013 by loraloper_22
HelloMy problem is i want to take the amount of seconds from user, and my program will run for this amount of seconds. Now i am very new in coding i Know how to get a value from text box but i want to convert it in the seconds?. for example if user entered 3 i want it to be 3 seconds.English...
8 Sep 2013 by Joezer BH
Your line is just fine for converting your textbox's text to an int.//You could also use int.Parse(textBox1.Text);Using the counter variable in your code as seconds will be when you use it in the code's context.e.g. main(){ counter = Convert.Toint32(textBox1.Text.Trim()); ...
8 Sep 2013 by Nitin Singh India
If you want to delay the execution of a code block for a given period, and want the period to be given as input at runtime from the user, you code to take in intervals in seconds is ok. Once you have this time, convert it into milli-seconds (x 1000) and have a call to Thread.Sleep(period) and...
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...
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...
1 Oct 2013 by phil.o
Check for TimeSpan structure.
2 Oct 2013 by Singh Gyan
or you may go with Timer control.
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
23 Jul 2015 by xszaboj
What is Algorithm Time Complexity?
20 Sep 2013 by eng.iris
hi there i have some doubts which are 1-can i have only time field or date field in MS SQL SERVER 2005 ,,,all i see is datetime and there is no fromat to change ?2- i have a time let say "02:23" how can i know that this tim is am or pm ???stupid ones but mind is asking...
20 Sep 2013 by ZurdoDev
SQL 2005 does not have a DATE format, only DateTime. I think it may be SQL 2012 that has a date format. However, what you'll store in the database is 0 for the day, which depending on your COLLATION may be 1/1/1900 and then store the time. The time is stored in 24 hour format so 1:00 PM is...
20 Sep 2013 by eng.iris
Quote:SQL 2005 does not have a DATE format, only DateTime. I think it may be SQL 2012 that has a date format. However, what you'll store in the database is 0 for the day, which depending on your COLLATION may be 1/1/1900 and then store the timeaha i got it but the 2nd ques Quote:The...
11 Jun 2022 by honey the codewitch
Create a simple synchronized analog clock using GFX, and a bit of code
9 Aug 2011 by helldevil1912
I'm building a streaming video server. Now I must transfer sequence data (data packets) of a video file to client. But I don't know timer tick to transfer a data packet. If i transfer too fast, client don't have enough time to decode and display.I don't know whether it depend on Bitrate or other...
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...
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
18 Oct 2013 by ASP.NET Community
Improve the scalability of a website and efficient design for time consuming processes.
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
12 Dec 2016 by Suresh Dasari's
Auto Generate Code (CRUD) for 3 Layered architecture (Entity, Data Access & Business Layer) with Stored Procedures based on table design.
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...
18 Apr 2010 by Guy Tal
Hello,I am writing server-client application in C#.I need to make synchronization between server and client.I need it because every time when the client sends a message to the server, it (the client) has to know what is the exact time now in the server.Where can I find information...
18 Apr 2010 by Not Active
Why does the client need to know the time on the server? Where is this message being sent to on the server? I would just send the message and let the process on the server tell the time.
18 Apr 2010 by Abhinav S
Have a look at this post here[^].It discusses various way to do this plus recommended practices.
11 Jul 2017 by Member 13302374
Hi there, A question given to me is asking me to return the total minutes passed today until now (i.e. the time right now). I know the right code format is myDateTime.TimeOfDay.TotalMinutes. which will give us the number of minutes that have passed in the day represented by myDateTime starting...
11 Jul 2017 by F-ES Sitecore
public static int GetTotalMinutes() { return (int)DateTime.Now.TimeOfDay.TotalMinutes; }
24 Dec 2011 by Joel Whatley-
Is there a way to ask user for input but after a certain time do somethin else if they don't give inputfor example: while (true) { if (d.Key == ConsoleKey.UpArrow) { v--; } if...
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...
24 Dec 2011 by Monjurul Habib
while (true) { if (d.Key == ConsoleKey.UpArrow) { v--; } else if (d.Key == ConsoleKey.DownArrow) { v++; } else if (d.Key == ConsoleKey.RightArrow) { h++; } else if (d.Key == ConsoleKey.LeftArrow) { ...
26 May 2011 by orenbt78
Hi,I would like to detect during my C# application run-time a manual change of the system time and date and automatic daylight savings time change.Moreover I am looking for a way to detect these changes that happened during the time the application was offline when the user launched the...
26 May 2011 by Kim Togo
There is a SystemEvents.TimeChanged[^] event that is triggered when the user changes the time on the system clock.When the program is not running, you can store the value in DateTime.Now.IsDaylightSavingTime and use this to compare at next startup.
18 Dec 2011 by Member 8498798
I am writing an IRC bot that needs to advertise something every few minutes to the channel. I made an attempt with the Timer but it's so messy I can't paste it here because it will be unreadable, I can post the entire file's code to pastebin though.What needs to be looped/timed to send every...
30 Dec 2011 by Manfred Rudolf Bihy
The problem is not in the code you posted, but where it is invoked. Somewhere either you directly or some part of the framework calls the function you mentioned with no parameters. The definition of said function takes two parameters none of which you nor the postulated framework...
29 Oct 2010 by redwolfhome
HiI want to write a program which have to convert the last written time of a file to a timestamp.But the result is wrong:Time: 24.10.2010 13:23:27 (Days, Month, Year Hours,Minutes,Seconds)Timestamp: 1287926608But this Timestamp is for 24.10.2010 15:23:28 and this is wrong.Maby you...
29 Oct 2010 by Not Active
date1.ToString("yyyyMMddHHmmssffff");
29 Oct 2010 by William Winner
I'm sorry...what are you expecting it to output?Because you are telling it to output the total seconds that have elapsed between the last written time and the January 1, 1970..Why are you messing with TimeSpans at all? Mark was close...but date1 is just a number you picked because,...
1 Apr 2013 by ShaketheDustOffMyFeet
I am needing help creating a WPF application where the user schedules a DATE in the future and a TIME in the future to where it will then call some method or do something else like go invisible. I am not concerned with what it does after the interval is set. I have all the needed functionality...
1 Apr 2013 by Sergey Alexandrovich Kryukov
No, if you simply need to track elapsed "real" time, use System.Diagnostics.Stopwatch:http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx[^].This is the most accurate way of measuring time available.As I cannot be sure I really can understand the scenario and the...
22 Apr 2013 by Owen 'Junior' Watson
Hi guys!I am trying to create an array that stores 4 lap times, for example:Double arrayName[4] = {1.40, 1.45, 1.32, 1.20};Then I need to add all these figures together and produce a total, average, fastest etc.My problem is, they are not calculated as time, but as floating point...
22 Apr 2013 by H.Brydon
The app you are using is very badly formed (or if you wrote it, you should rewrite it).Really the only way to do this properly is to convert the times to number of seconds (even if the elapsed time is years, weeks, days, hours, minutes or already seconds) and then you can do all the...
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
24 Aug 2022 by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.
11 Apr 2022 by Patrice T
Quote: If the input size n is 10^9, then it should take 10^9 * log(10^9) / 10^9 = 9 second, right? No ! You don't calculate runtime from Big O notation, at least not by itself. The Big O notation tells you the category complexity of an...
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).
11 Apr 2022 by OriginalGriff
To add to what the others say, you can't equate clock cycles directly with execution time anyway - some machine operations take n cycles to execute, others may be n * 2. To add to that, modern processors are pipelined - so some instructions may...
11 Apr 2022 by Greg Utas
30 seconds is about right if it's log2(n). log2(1000) ~= 10. EDIT: O(n log(n)) algorithms often recursively divide the problem in half, solve each part separately, and then combine the solutions. This is why log2 is usually implied. Mergesort is...
11 Apr 2022 by Luc Pattyn
the big O notation only tells you how the execution time will change when the "size" of the problem is changed, it does not provide an actual estimate for a specific case. In other words, there is an unknown factor, so for example O(n2) could...
11 Apr 2022 by Hoang Minh Quang FX15045
I'm learning a Coursera course about time complexity. I encounter this in a video and I think something is wrong. "So suppose that we have an algorithm whose runtime is roughly proportional to n and we want it to run it on a machine that runs at...
17 Jan 2024 by Mickey P
Big O notation talks about generalizations. its similar to if you were doing size estimates in lets say economics: such that 1000 and 750 would be both rounded to 1000 and what is interesting is 10K is not in the same ballpark of 100K but 13K is...
12 Apr 2013 by Gettor9000
I have a C# project that takes multiple (2 at the moment) microphones as an audio devices, detects sound from them, processes their audio frames with Fourier Transform and displays them. It also prints them in three colors: red is for microphone that has stronger input, green is for microphone...
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.
3 May 2014 by Duaa7
i'm using serial ports in my program will it interfere with it? and would it ever be okay to use one timer to continuously read from the port? or it is a bad ideathank you
3 May 2014 by OriginalGriff
You can use more than one timer in an app , but it's not a good idea, as timers are scarce resources and you shouldn't use more than you have to. I generally use just one (when I have to) and set it to 1/10th second or similar then use counters within the timer Tick event handler to process...
9 Mar 2015 by SGS97
I cant change the systemdate, any ideas? public struct Data { public ushort Year; public ushort Day; public ushort Month; public ushort Hour; public ushort Minute; public ushort Second; public ushort Millisecond; public ushort...
9 Mar 2015 by Richard MacCutchan
Read This Fine Manual[^].
3 Nov 2013 by Member 10235977
On my site I have a clock that displays US time.Is there a simple way to change from summer time to winter timeor I have to change my code every winter and summerI am using ASP.NET with C#
3 Nov 2013 by Sergey Alexandrovich Kryukov
It depends on the OS used to host your HTTP server, but most of OS are configured to automatically switch summer saving time shift on and off, depending on location and date. You don't have to worry about it. System.DateTime.Now will simply give you correct time.Another solution is to use...
22 Apr 2021 by Member 10850253
I had previously made an app to change windows time in c#, to a previous time, and it used to work fine on windows 7, but now on windows 10 it will just not work. What I have tried: private void button1_Click_1(object sender, EventArgs e) { h1 = h;//hours ...
20 Apr 2017 by OriginalGriff
First off, you dont; want to do that - there is no good reason for altering the time, since most Windows installations now use a NTP server by default to maintain the system time accurately - and the NTP server will override your app anyway. In addition, as Jochen said, you need admin...
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...
11 Sep 2014 by Matt T Heffron
The TimeSpan struct is your friend!Just create a new TimeSpan from the count in seconds, and use its .ToString(formatString) to format it:TimeSpan elapsed = TimeSpan.FromSeconds(elapsedTimeSecondsCounter);string elapsedFormatted = elapsed.ToString(@"m\:ss");
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;
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...
19 Jan 2017 by OriginalGriff
The problem is that 00:00:00 is not a date time format - it's a timespan. A date time value requires a date, and is limited to 23:59:99 as the time component as well, so you can't just say "90,909 seconds is a datetime of 25:15:09" because that isn't a valid datetime value.I'd either return it...
10 Mar 2012 by Frex89
Hi guys! could someone help me? I have a time from DateTime.Now and I want to convert it to italian time! what should i do?? tx
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" );
10 Mar 2012 by Shahin Khorshidnia
Hellopub...
11 Mar 2012 by Sergey Alexandrovich Kryukov
There is no such thing as "Italian time". Time is always System.DateTime. If you need to present it in Italian, it's not time, this is string, which has nothing to do with time.However, if you mean Italian time zone, you need to use the time zone class System.TimeZoneInfo, please...
29 Aug 2017 by Rodrigo Alex Rodriguez
private void button1_Click(object sender, EventArgs e) { TimeSpan a = new TimeSpan(12, 00, 00); TimeSpan b = new TimeSpan(13, 00, 00); TimeSpan r = b - a; TimeSpan rr = new TimeSpan(r.Ticks / 2); ...
29 Aug 2017 by OriginalGriff
You can't convert a Timespan to a DateTime: that doesn't work because it's not a logical action. Think about it: If I ask you to meet me at "plus 6 hours 30 minutes" what does that mean? Nothing - unless it's understood that there is a starting point for it to be relative to. In terms of normal...
29 Aug 2017 by Jochen Arndt
You can not convert a time span to a datetime. You might add the span to a specific datetime (e.g. the current time). If the span is always positive and less than 24 hours, you can use the DateTimePicker with the time only (see How to: Display Time with the DateTimePicker Control | Microsoft...
16 Jan 2015 by Member 11380284
how to convert utc time to 24 hours format in HH:MM:SS?
16 Jan 2015 by Richard Deeming
Custom Date and Time Format Strings[^]:string formattedDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss");// Example output: 2015-01-16 16:26:32
16 Jan 2015 by Sergey Alexandrovich Kryukov
In addition to Solution 1:Please see all related methods:http://msdn.microsoft.com/en-us/library/system.datetime.tostring%28v=vs.110%29.aspx[^].What you need is formatting. is not "conversion". Note that parameters allows you to format depending on culture...
27 Feb 2014 by Member 9829329
Hello All,if i analyzed any system then i build Database and code from beginning. what is the percentage for time of the building (Implementation)? for example ( visibility study 5%, Collect Requirements 5%, Describe the system 10% Analyze system (DFD or UML) 35%, implementation 40%,...
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 =...
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[^].
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!
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 Jul 2012 by smss IR
How to create a timer from system date to a specified date and reverse counter of time to the notify a message on a new window?( on linux & windows )Thanks.
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".
27 Mar 2014 by Eli k
hi,,i am trying to make a small timer utilityi based on timer_createthere are three types of callbacks using the timer_create api:SIGEV_SIGNALSIGEV_THREADSIGEV_THREAD_ID when i create single time all workswhen i create more then one time from (SIGEV_SIGNAL+SIGEV_THREAD_ID)...
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...
7 Mar 2012 by Mohibur Rashid
I dont think you need to create any session id for this. in http protocol session is important to identify the user. cause after transferring data between server and client the connection is terminated. but in case FTP it close its connection when it get an exit request from client. But if...