I want to allow users to update their document only in specific hours say 19th hour in the evening to 5th hours in the next morning. I have found the way to compare between day but note the time. I need a way to compare the evening hours of the same day and the morning hours of the next day.
This will make sure the update is only done between 19 and 5 in UTC:
allow update: if request.time.hours() > 19 && request.time.hours() < 5
You will have to customize this depending on the time zone you want to address
Related
Using the availability API is it possible to get the DAYS only between two query periods that a user has availability in their schedule based on the provided duration? It is unreasonable to receive and process 512 time slots to, for example, see if the user has availability in the month of May. Plus that might not even be enough data.
For example if a user has the following available:
May 1 9am
May 2 between 9 and 3pm
May 3 no time
May 4 ...
Could we get a result that says, the user has at least 1 hour (ie provided duration query) for these days? In this case it might return an array of dates like May 1/2/4/... or an array of time slots like May 1 9am, May 2 9am, May 4 10 am
Not right now. But it's a request we've had before and we plan to support it later this year.
I am trying to user google calendar api to schedule events,
they have different recurrency types
type1: weekly
type2: every 14 days
type3: every 28 days
type4: every 42 days
type5: every 56 days
The problem is:
if the 56th day falls on the weekend, the appointment should be moved to monday.
I am new to rrule, and am trying to get my head around this.
Can someone help me to understand a little bit?
Nevermind, Just noticed that for this specific answer, all the types are variations for the weekly
type1: weekly - weekly :)
type2: every 14 days - weekly, every other week
type3: every 28 days - weekly, every 4 weeks
type4: every 42 days - weekly, every 6 weeks
type5: every 56 days - weekly, every 8 days
For the sake of future implementations, and for me to try to understand RRules better, though, let's make this a bit harder, WHAT IF this is something like:
type1: weekly
type2: every 13 days
type3: every 27 days
type4: every 41 days
type5: every 55 days
Can someone please try and explain me how to go through this issue?
Thanks!!
You can import .ics files into google calendar that define recurring events. Once imported, they are not editable, however.
This should get you going How can an ICS file be written for a recurring event?
In the REAL-TIME / Overview page, you can see how much people are currently browsing your site. Although, how do you know if this current value is good or bad? I would like to know how much people were browsing my site the same time the day before, so I would know if I have 5% more or less people.
Also, how would I know if the site is doing it better or worse than 1, 2 or 5 hours before? The REAL-TIME shows the last 30 minutes of per minute page-views, but how do I know if the site is going down or up compared to a few hours before? 30 minutes is not enough.
Is there any add-on to add, custom modification to make, or free/paid service to complement?
You want to use the standard ("core") reporting. The dimensions that will help you are (UI / API):
Hour / ga:hour: A two-digit hour of the day ranging from 00-23 in the timezone configured for the account. This value is also corrected for daylight savings time. If the timezone follows daylight savings time, there will be an apparent bump in the number of sessions during the changeover hour (e.g., between 1:00 and 2:00) for the day per year when that hour repeats. A corresponding hour with zero sessions will occur at the opposite changeover. (Google Analytics does not track user time more precisely than hours.)
Hour of day / ga:dateHour: Combined values of ga:date and ga:hour formated as YYYYMMDDHH
Date Hour and Minute / ga:dateHourMinute: Combined values of ga:date, ga:hour and ga:minute formated as YYYYMMDDHHMM
Hour Index / ga:nthHour: The index for each hour in the specified date range. The index for the first hour of the first day (i.e., start-date) in the date range is 0, for the next hour 1, and so on
With the UI you can add a secondary dimension to reports or build custom reports, with the API you can need to build your requests from scratch (try the explorer, official API doc).
I am trying to think of the best way for a user to input a start hour an end hour but I need to be able to support both AM/PM and 24 hour time representation. Currently I was thinking of a drop down list with AM, PM, and Military to distinguish each time but since this is a page for time sheets that would mean 56 drop down lists and that sounds TERRIBLE
Do you have suggestions on how to do this ? Is there a javascript time picker that already does this ?
There's a box where you can type the hour and grayed-out AM/PM dropdown/radio button set. If the user types in a number less than 13 in both boxes, the AM/PM chooser activates and is required. If they enter a number greater than 12 in either box, it doesn't.
Let's say that guy register's to my site for 5$ for 30 days. So how do I make code that automaticly after 30 days delete's his account?
Thanks for answers and sorry for poor english
Respectfully, Tom
Use the date handling functions of your preferred programming language. Do not attempt to implement it yourself. It's harder than you think.
I'd suggest simply noting the account's expiration date in its record, rather than having some sort of scheduled process to delete expired accounts.
For a .Net example: when you receive the $5 payment, set the account's expiration date to DateTime.Now.AddDays(30), and reject login on an account where expirationDate < DateTime.Now.
In Java, you'd need to pour the Date into a Calendar in order to add days, then pour it back into a Date when you're done.
However, what facilities are available to handle dates are determined by your environment.
If you can, convert the registration date and the current time to UNIX timestamps. Then subtract their registration time from the current time and check if the result is greater than the number of seconds in 30 days. (60 seconds * 60 minutes * 24 hours * 30 days = 2592000 seconds.)
Most likely you would run a cron job every day or so and check and see if an account's last payment was 30 days ago, and then delete the user. However, manipulating the date is difficult to explain unless we know what language you are using. Since you specified DateTime I'm going to assume that you mean the .NET DateTime object and then you can just do DateTime.addMonths(-1); or DateTime.addDays(-30) respectively.
If you just have to count 30 days you can count them as 30 * 24 * 60 * 60 = 2592000 seconds and simply subtract the unix timestamps.
Anything more complex than this is a PITA to implement yourself and yuo should follow recursive's advice.