time

How would you store and query hours of operation?

We're building an app that stores "hours of operation" for various businesses. What is the easiest way to represent this data so you can easily check if an item is open? Some options: Segment out blocks (every 15 minutes) that you can mark "open/closed". Checking involves seeing if the "open" bit is set for the desired time (a bit lik...

What is the Best Way to Represent Summer Time Rules?

I need to store the summer time (daylight saving time) change-over rules for different world regions in a database. I already have a way of storing regions and sub-regions (so the whole "half of Australia"/Arizona/Navaho problem is taken care of), but I'm wondering what the most efficient schema would be to accomplish this. The two opt...

How do you add a timed delay to a C++ program?

I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at? I wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed delay I am not sure on how I should even attempt to implement this...

.NET time sinkholes?

What .NET issue have you run into that wasted hours and hours of your time, was nearly impossible to debug, and could have been easily avoided if you had known just one quirk of the framework? ...

State and time transending logic and program flow?

Wondering if it would ever be useful to index every possible state of an application using some reference keys... Meaning, say we have a program that starts, has only so many possible outcomes, say 8. but if each outcome is attained through stepping through many more logic states, and in between each branch is considered to be a state ...

java date format incompatible with xquery xs:date format, how to fix?

In java, when using SimpleDateFormat with the pattern: yyyy-MM-dd'T'HH:mm:ss.SSSZ the date is outputted as: "2002-02-01T18:18:42.703-0700" In xquery, when using the xs:dateTime function, it gives the error: "Invalid lexical value [err:FORG0001]" with the above date. In order for xquery to parse properly, the date needs to look like...

How do I get the last possible time of a particular day

Hi , I'm trying to achieve the last possible time of a particular day eg for Date of 2008-01-23 00:00:00.000 i would need 2008-01-23 23:59:59.999 perhaps by using the dateadd function on the Date field? ...

Time math in Delphi

I have a pretty unusual problem (for me). I am writing an application that will allow a user to change their system time forward or back either by explicit date (change my date to 6/3/1955) or by increment using buttons (go forward 1 month). I'm writing this to help some of my users test some software that requires jumps like this in ...

How to render contextual difference between two timestamps in JavaScript?

Let's say I've got two strings in JavaScript: var date1 = '2008-10-03T20:24Z' var date2 = '2008-10-04T12:24Z' How would I come to a result like so: '4 weeks ago' or 'in about 15 minutes' (should support past and future). There are solutions out there for the past diffs, but I've yet to find one with support for future time diff...

Converting mysql TIME from 24 HR to AM/PM format

Hi, I want to display the TIME field from my mysql table on my website, but rather than showing 21:00:00 etc I want to show 8:00 PM. I need a function/code to do this or even any pointers in the right direction. Will mark the first reply with some code as the correct reply. ...

Incorporating shareware restrictions in C++ software.

I wish to implement my software on a shareware basis, so that the user is given a maximum trial period of (say) 30 days with which to try out the software. On purchase I intend the user to be given a randomly-generated key, which when entered enables the software again. I've never been down this route before, so any advice or feedback o...

Flash exporting/publishing time

What are the main reasons for having ridiculously long export times for a simple flash movie to swf? I have no unnecessary images or symbols, everything possible is set to lower than low and it still takes 10 minutes and upwards to export a 30 second animation at 24 fps. I have even created a new fla and pasted everything in there, to fi...

How to convert milliseconds into human readable form?

I need to convert an arbitrary amount of milliseconds into Days, Hours, Minutes Second. For example: 10 Days, 5 hours, 13 minutes, 1 second. I'm pretty sure that the trick is fairly simple, but I'm slammed today so I thought I'd reach out to SO's geniuses for a quick fix. Thanks :) EDIT: The language I'm using does not have this bui...

How to convert UTC time to Time in any other time zone in C#

Hi - I am working in C#.net - .Net fx is 2.0 which doesnot support converting between different time zones. I have wrote a scheduler based on UTC but it is giving errors of 1 hour in the DTS periods for London. I need some solution so that I can gat the correct time in any timezone relative to UTC with correct DST adjustments. ...

When running UPDATE ... datetime = NOW(); will all rows updated have the same date/time?

When you run something similar to: UPDATE table SET datetime = NOW(); on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be when the query started or when each row is updated? I'm...

Programming timing shellscript measuring program execution time at 0 seconds.

My professor wrote this shell script to time my program, and display the results. For some reason it just outputs 0s with my program. He provided the following files: timeit.csh sequence ecoli2500.txt ecoli3000.txt ecoli5000.txt ecoli7000.txt ecoli8000.txt ecoli9000.txt ecoli10000.txt Here are the contents of ...

How Do You Programmatically Set the Hardware Clock on Linux?

Linux provides the stime(2) call to set the system time. However, while this will update the system's time, it does not set the BIOS hardware clock to match the new system time. Linux systems typically sync the hardware clock with the system time at shutdown and at periodic intervals. However, if the machine gets power-cycled before o...

Saving the time the user is logged on.

In the application I am developing I have to store the time some particular users remain logged into the application, unfortunately, in web applications there are several ways the user can log off. 1.- User clicks log off. 2.- User session expires. 3.- User closes the window. 4.- User types another site url in the address bar. The firs...

Oracle 10gr2: enforce dates entered are between 9am and 5pm?

I want to enforce that date-times that are entered fall between 9am and 5pm. How do I enforce this with ORACLE CHECK constraints? ...

Set time programmatically using C#

What is the best way to set the time on a remote machine remotely? The machine is running Windows XP and is receiving the new time through a web service call. The goal is to keep the remote machines in synch with the server. The system is locked down so that our web service is the only access, so I cannot use a time server on each rem...