I am trying to send Outlook meeting request with Java. When I send in UTC, Outlook adjusts the timezone to client's calendar and shows. What should I do to make the client not to adjust automatically to client's timezone?
Ex.: If I send a meeting for 5PM Pacific to a client who is in Eastern, it should still appear as 5PM in client's calendar.
My request has:
DTSTART:20181029T070000Z
DTEND:20181030T070000Z
If you want an event to appear at the same time of the day, regardless of the timezone of the attendee, you want to use floating time. It is essentially the same syntax, without the final Z. See https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5 , e.g.
DTSTART:20181029T170000
for an event that shall start at 5PM wherever the location of the recipient.
Beware though that this is a really strange thing to do for meetings. If you have an organiser in one time zone and attendees in other timezones on a conference call, they will end up dialing in at different times. Is this really what you want ?
Related
I programmed a simple calendar app where you can add Events to specific Dates.
When I close the app it still should check once a day which Date is it and if an Event is on this Date. If there is an Event a push notification shall appear.
How could I do that? I save the Date with an event within the sharedPrefrences.
Can someone help?
If it doesn't matter when during the day the notification is sent, then #AliasCartellano comment is correct. However, if you want to send the notification at a specific time during the day (i.e. not at 23:59 when the user is sleeping), then you should use AlarmManager. Specifically, look at setAlarmClock(). This is its intended usage.
How to get client/request timezone in jsp?
Unfortunately this information is not passed in HTTP headers.
Usually you need cooperating JavaScript to fetch it for you.
Web is full of examples, here is one http://www.coderanch.com/t/486127/JSP/java/Query-timezone
you cannot get timezone, but you can get current time from client side.i.e. through javascript and than post back. On server side, you can convert that time to GMT/UTC. The UTC shows the TimeZone.
If you just need the local timezone in order to display local times to the user, I recommend representing all times in your service in UTC and rendering them in browsers as local times using Moment.js.
My general rule is to handle and store times in UTC everywhere except at the interface with the user, where you convert to/from local time. The advantage of UTC is that you never have to worry about daylight-saving adjustments.
Note that if you want to show the age of something (e.g. "posted 3 hours ago") you just need to compare the UTC timestamp with the current UTC time; no need to convert to local times at all.
Best solution for me is sending date/time as a string, and then parse with server's timezone to get a timestamp. Timestamps are always UTC (or supposed to be) so you will not need client's TimeZone.
For example, sending "10/07/2018 12:45" can be parsed like:
SimpleDateFormat oD = new SimpleDateFormat();
oD.applyPattern("dd/MM/yyyy HH:mm");
oD.setTimeZone(TimeZone.getDefault()); // ;)
Date oDate = oD.parse(request.getParameter("time"));
Obviously you can set your specific date/time format.
I am using vertex 3.x. I have a requirement to access timezone from HttpServerRequest object to provide timezone based data to user.
It doesn't have one, basically. There's nothing in a regular HTTP request to identify the time zone.
Your options are:
Use an IP geocoding API to guess at the user's location, followed by a location-to-timezone conversion (e.g. through another API)
Use Javascript to detect the time zone - there are various libraries available to do this, usually resulting in an IANA time zone ID such as "Europe/London"
Probably in conjunction with the first two, offer the users a choice so they can confirm their actual time zone
Note that detecting location from IP address can be fraught with issues due to proxies which are often employed by large corporations.
Also note that even once you've got the same time zone ID as the browser, it's entirely possible that your copy of time zone data on the server will be different to the time zone data in the browser - it changes reasonably regularly. (You'd be fairly unlucky to hit a problem, so long as you keep your data up-to-date, but you should be aware of it.)
I have an API written in Spring. For the date and time properties, I use the Java Time API (more specifically LocalDateTime) and an Android client which is heavily reliant on time related information.
When the client issues a request, it can send the city where the user is located.
How can I obtain a ZoneOffset from the information in the request so the date and time in the response are appropriate to the user's location?
If you know the capital of the state you are in, you can use it's TimeZone as these are available. The trick is knowing which state or province you are in.
If you know the lat/lot you can work out the likely difference from GMT and whether you are in day light saving but this would be approximate.
Is there a way to get today's date and time such that it corresponds to the real world date/time and is not affected if the user has changed the date/time settings on their phone/web browser?
If not, is using a server time the best way to correctly determine today's date on the phone? Or are there other best practices?
if you don't want to use a server time, u can parse the return of gettime() link
Server time suits most of the needs. Then if your server's time is messed up then you will be in problem.
Alternatively, you can use some third party web service to provide you with the time.
For example
https://developers.google.com/maps/documentation/timezone/
Google being a reputed company, the time returned can be trusted to be correct.
I'd never trust a user's device to retrieve time related information.
Get the UTC time from the server and if required, display it to the user converted to his time zone. Here's a so question on how to convert UTC time to local time with JS
This way your stored time will always be ok and in same "format". The only thing that could happen is that the ends up seeing a "wrong" time, if he faked his location / time zone settings. But I wouldn't mind that.