I have been given a list of times (shop opening hours) but the format seems really weird and doesn't seem to be any format that I can figure out and they didn't specify what format the time is in.
I'm guessing it's pulled straight form a database but doesn't seem to be seconds.
Example
Opening time: 80000 (i'm assuming this is about 7:30 am in the morning )
Closing time: 170000 (i'm assuming this is about 9:00 pm)
Any guesses?
Looks like it could just be 8 AM (8:00:00) to 5 PM (17:00:00). Probably the last two digits are seconds, the two to the left of those are minutes, and the remaining digits are hours, from 0 to 23.
Related
I've got a logic app that runs every 15 minutes. I'd like to make it only run every 15 minutes between the hours of 8 AM and 4 PM, but I'm unable to figure out how to go about that.
My understanding thus far is that I can't add that condition to the Recurrence, which is set to 15 minutes, and that I'll probably have to make it so that every 15 minutes, if time is between 8 AM and 4 PM, do x... but I'm still struggling to figure out if I ought to be using the "Get current time" feature and using a conditional comparator - if this is the case, how do I make the comparison?
Thanks in advance!
I think you achieve it in using Recurrence trigger itself. As shown below I have it for every 5 minutes on Monday to Friday between 8 am to 7 pm
You can also go through this documentation for any additional details
Below sql showing 57 hours, But,it's 44 hrs. How can i solve.
SELECT DATEDIFF(Hour,'2018-11-20 2:26:38.000','2018-11-22 11:00:29.367')
Use 24 hr format in both dates
SELECT DATEDIFF(Hour,'2018-11-20 14:26:38.000','2018-11-22 11:00:29.367')
Not prefixing the hours to be two digits looks like it could be the issue, making it unambiguously in the afternoon gives your result.
/*------------------------
SELECT DATEDIFF(Hour,'2018-11-20 14:26:38.000','2018-11-22 11:00:29.367')
------------------------*/
45
You're default Date Time format is probably 12 hour, and "2:…" is being treated as pm.
Using two digits for the hour should help.
/*------------------------
SELECT DATEDIFF(Hour,'2018-11-20 02:26:38.000','2018-11-22 11:00:29.367')
------------------------*/
57
(SQL Server has a lot of backward compatibility which may be triggered is the input is not precisely formatted, ISO Date/Time formats always use two digits for hours, minutes, and seconds.)
If you are using a client (rather than fixed code in a Stored Proc/Function/Trigger/…) parameterising your queries avoids this issue: pass data as Date-Time type directly without any need to convert into a string.
Long time lurker and now i have my first question:
I'm designing a SQL Report. One Task is to calculate the amount of minutes between two Times. They can be the same day or on different days. In the Database there are 4 Columns given
The Start Date (as Datetime e.g. 24.10.2017 00:00:00)
The Start Time (as Datetime e.g. 01.01.1899 11:25:00)
The End Date (formated as above)
The End Time (formated as above)
I'm calculating three Filds, all in Minutes
Days between: =DateDiff("n", Fields!StartDatum.Value,Fields!QualDatum.Value)
Minutes between: =DateDiff("n",Fields!StartZeit.Value,Fields!QualZeit.Value)
Adding those up: =Fields!QualiZeitTage.Value+Fields!QualiZeitMinuten.Value
All of this is working great and produces the desired output.
My Problem is, that i don't need the full time between those events. I only want to count minutes that are between 7:00 am and 8:00 pm. Also, i want to exclude Saturdays and Sundays. How would i go about limiting the datediff function to my desired times?
Second Problem: The Endtime and Date are only written when the event actually is finished. If it's still ongoing those Fields are empty producing a negative number (-1060764480 for example). Since i'm only using those to produce Boolean output on surpassing a certain length, it's no problem. I would like to handle that more "cleanly" though. Any thoughts?
The Google App Engine memcache documentation states that the time parameter of memcache.set() is an "Optional expiration time, either relative number of seconds from current time (up to 1 month), or an absolute Unix epoch time."
So I tried to set a value for 30 days, which according to Google is 2 592 000 seconds.
However, I highly suspect that this value is too high, because the value was set (memcache.set() returned the value True), but a memcache.get() just after always returned None. Reducing this value to 1 728 000 seconds just worked fine/as expected.
I guess that once passed the highest value, the time parameter gets interpreted as an absolute Unix epoch time. That would mean that 2 592 000 seconds got interpreted as "Sat, 31 Jan 1970 00:00:00 GMT", which is obviously a date in the past...
So what is the highest value you can enter that will get interpreted as a number of seconds in the future?
Edit: On the local dev server, 2 592 000 second worked OK, but not on the production servers. I suppose both servers have a different interpretation of the values.
Your linked Google documentation is oddly imprecise; the actual memcached documentation is more specific, saying the number may not exceed 2,592,000 (30 days of seconds). So in theory, that should have worked, barring implementation issues. (That statement is echoed in the PHP documentation for its memcache stuff.) So according to the memcached docs, your first value should have worked.
I don't suppose 2,591,999 works? The Google doc does say "up to one month", which if you assume 30 days in a month (not a valid assumption) would be up to 2,592,000 (e.g., but not including). That's at odds with the memcached docs, but perhaps there's an implementation difference or something.
I'm writing an application that indexes data for our stores, some of which are open late (8 am - 2 am). We need to be able to search this database quickly -- basically, to run a query to find which stores are open at a given point in time (now, Sunday at 1 am, whatever).
In addition, the open/close times can vary day-by-day -- some stores are closed on Sundays, for example.
The obvious solution to me would be to make a table where I have a row with the store ID, day, open time, and close time. For something like Monday, 8 am - 2 am, that would actually be two rows, one for Monday 0800 - 2400, and one for Tuesday 0000 - 0200.
We have a lot of stores, so the search has to perform well (basically, the data has to be index-friendly), but I'll also have to display this data back out in a human-readable format. With my current solution, that'd look something like this:
Monday: 8:00 - Midnight
Tuesday: Midnight - 2:00 am; 8:00 am - Midnight
I'm just wondering if anybody else has alternative solutions before I jump right to an implementation. Thanks!
When PBS (the US Public Broadcasting System) faced this same problem a couple of years ago, they invented the idea of the "30 hour day" -- Where 00:00 is midnight at the start of the day, 24:00 is midnight at the end of the day, 25:00 is 1am the next day, 30:00 is 6am the next day. That way Mon closing time of 26:00 is 2am Tues morning.
Rather than two records representing a single store's times for a day, it may be more object oriented to think of the "store day" as the object. That way 1 record = 1 store's times for a day. If you want to store the two sets of open/close times, just use four fields in the record instead of two--and adjust your queries appropriately.
Remember that your queries should use a library/api that you write and publish. The library will then deal with the data store and its data layout. No one but your library should be looking at the db directly.
Time zones are very important in this sort of app too. (Hopefully) at some point, the store chain will expand to cover more than one time zone. You'll then need to determine the local time of the query. -- May not the same as the time zone of your server which is handling the queries.
Further thoughts--
I now see that you're standardizing to GMT. Good. You could also use datetime values (vs time values) and standardize to a given week in time. Eg open time is Sun Jan 1, 1995 10am - Mon Jan 2, 1995 2am (using Jan 1, 1995 as a base since it was a Sunday).
Then rationalize your "current time and date" to match the same point in the week of Jan 1, 1995. Then query to find open store days.
HTH,
Larry