I wrote a .NET program that creates live events in Youtube, but I cannot set the correct starting time and some settings like Keywords, and Region. This is what I do, when I create the Broadcast I put the starting Date and Time this way:
oLiveBroadcast.Snippet.ScheduledStartTime = String.Format(CDate(txtScheduledStart.Text), "yyyy-MM-ddTHH:mm:sszzzz")
...but the GMT is always referred to US (GMT -8). I think that the problem is in the receiving field .Snippet.ScheduledStartTime which has a dateTime format not including GMT. What can I do?
I also didn't find how and whare to set Region (in my case Itali IT-it) and searching Keywords
Thanks
Related
There have been a couple of similar questions in the past, but none I've found have been fully answered so let me try again.
I'm writing this web app where users can select their particular timezone, which might be different from the one set up in their respective system. Say my computer is set to the "America/New_York" timezone. If I (for whatever reason) set up my timezone configuration to "Asia/Tokyo" within the web app, I would like to:
have the current month aligned with the configured timezone ("Asia/Tokyo") and
have the highlighted current date also set to the "Asia/Tokyo" timezone.
I've tried many different configurations without any luck...
$("#calendar").fullCalendar({
defaultView: "month",
timezone: "Asia/Tokyo",
ignoreTimezone: false,
defaultDate: moment("2019-03-10"),
header: {...
In this case, I'm hard coding the defaultDate for tomorrow ("2019-03-10") to see if the current date highlight changes to no avail.
Is there a way to accomplish these two issues?
Update:
Okay, the answer to question (2) I found to be the parameter now. In this case, things would look like...
$("#calendar").fullCalendar({ defaultView: "month", now: moment().tz("Asia/Tokyo"), ...
As explained above, if say, my laptop is said to be configured with the "America/New_York" timezone, but I'm actually in Japan and my web app config reflects that, it won't matter. fullCalendar will now show the correct day for Today.
Still, the question remaining is (1): How to make the (monthly) calendar days be in sync with a given timezone? Thanks!
I am building an outlook addin which is active during compose/edit of an outlook calendar event. The addin accesses the start/end time of the event with the apis described
here. This yields a Time object, described here, on which I use getAsync() to get a Date object.
According to my interpretation of the documentation about the start property, the "result" argument of the callback called by getAsync() should be a time expressed as UTC, but this is not the case (it is expressed in local time).
But this, as far as I understand, is a javascript Date peculiarity, and I can handle it. The real problem I have is that outlook 365 allows to select a timezone in the event creation form, as can be seen here.
When I change the timezone, accessing the start property from the addin results in a different time (which is also expressed in local time). I would expect the same time (as before selecting a different timezone). Looking at the event created by Outlook in the calendar, it is also clear that Outlook does know it is the same time, expressed in a different timezone.
So, to make this more concrete:
create a new event in the calendar which for example starts at 11:30 and ends at 13:00 (selected timezone in compose form is local time, for example "Brussels Copenhagen Madrid, UTC + 1")
when accessing the start property from the addin, we get a Date object which contains "11:30 UTC + 1" (for a user located in this timezone)
now we change the timezone in the form, to "Moscow, St. Petersburg, Volgograd, UTC + 3".
when reading the start property, we now get a Date object which contains "13:30 UTC + 1", but we expect the same "10:30 UTC" or maybe "11:30 UTC + 1". The reason we expect this to be the same is that changing the timezone in which the time is expressed should not move the event in time. And actually outlook does not move the event (as can be seen in the calendar), but the start property is telling us that it does.
I'm aware of the Office.context.mailbox.convertUtcClientTime() and Office.context.mailbox.convertToLocalClientTime() methods but, as far as I understand and can test, I can not use those to get what I want.
So my question is: did I misunderstand something or am I doing something wrong, and if so, how do I get the real time at which the event starts/ends (in UTC preferably), but not depending on the selected timezone ?
Edit: This behaviour has been observed on Outlook desktop version (version 1901 click-to-run monthly channel, running on windows 10) and also with Outlook on the web (https://outlook.office365.com/) on multiple web platforms. Our manifest.xml file for the add-in contains the following section
<Hosts>
<Host Name="Mailbox" />
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1" />
</Sets>
</Requirements>
The index.html file of the addin contains the following:
<script type="text/javascript"
src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js">
</script>
Quick environment overview:
I have an ASP.NET MVC/AngularJS application that is ultimately being hosted as an Azure Webrole. The data is stored in MongoDB hosted in the same Azure data center (via MongoLab). Development environment and staging environment (Azure) point to same MongoDB database and thus see the exact same data.
Issue:
Individual users of the application are stored with their preferred timezone as a string (TimezoneID). All dates in the app are stored as UTC times. Conversion to and from UTC times to a users specific timezone is done on the server via an extension method which ultimately calls:
return TimeZoneInfo.ConvertTimeFromUtc(UtcDate, _lookup[TimeZoneID]);
Nowhere in the entire app is there a DateTime.Now or any other date conversion I would expect to use the server time settings.
In a particular area of the application a date is being stored in Mongo (UTC). I can confirm that the date is correctly stored as UTC (based on the offset from my local time). When I retrieve that date from the data store and convert it back to my local time (Central Standard Time) I step over the above line of code and the conversion works fine and the local time is set. The result is sent to the client's browser as part of a Json result of an API call and displayed to the user correctly. During transport the MVC Json serializer parses the datetime into a format similar to:
EventDate: "/Date(1399407153971)/"
I parse this in Javascript and display accordingly and all is good.
When I deploy the exact same code to Azure (which points to the exact same data store in Mongo) the result that comes down via the API call appears to have applied the UTC transformation twice (meaning the regular 6 hour UTC offset is applied twice and the displayed date is 12 hours earlier than UTC...6 hours off of what I want).
I've updated the stored time in Mongo by a minute or two to make sure both sides update and they do (verifying the same data). I've modified the date/time settings of my local machine to see if it has any effect on my local results and it does not. I've changed the timezone for the selected user in the app and both my local result AND the Azure returned result adjust by the UTC offset difference between Central Standard Time and the new time zone (meaning if I switch to Mountain Time the result of both the local result and the Azure result adjust by 1 hour...but are still 6 hours off). I've confirmed via Chrome Dev Tools that the date in question that is retrieved at the client (via Json) is different based on whether the site hit was the remove (Azure) environment or local environment (meaning it isn't being modified incorrectly anywhere on the client after-the-fact)
Here is the most telling thing:
If I convert the date to a string prior to returning it to the client the string sent down appears correct in the Json response. If I leave it as a .NET DateTime type (as a property of a complex object) the Json serializer appears to translate it again but ONLY when hosted in Azure. This has pointed me to the issue being somehow related to the DateTimeKind of the date I'm returning. Although, at this point, I'm too lost in the weeks to see why the difference between my local environment and the Azure host environment in serialization and why one things a time is correct and the other converts it twice. If the DateKindTime was wrong wouldn't both environments perform the same conversion?
Thanks for reading through this and I'd appreciate any ideas to address anyone has.
It's difficult to say for sure without seeing more code, but could it be that the problem is with conversion on the way in, rather than on the way out? You said that you're using TimeZoneInfo.ConvertTimeFromUtc for the output. Are you also using TimeZoneInfo.ConvertTimeToUtc on the other side? If so, that's likely the source of picking up your local time zone.
You might also somewhere have a call to DateTime.ToUniversalTime, which again - uses the local time zone.
Another area which might be the culprit - when you retrieve your value from Mongo, check the Kind of the values coming back. If they're Unspecified, then when they are serialized to JSON, they will be treated as if they were Local. basically, there's a ToUniversalTime call going on under the hood. So you may need to explicitly call DateTime.SpecifyKind to set the value to Utc before it goes out the door.
With specific regards to Azure, it follows best practices of setting the server time zone to UTC. You could try that on your own machine and see if you get similar results.
Of course, you really don't want the server's time zone to influence the result at all.
You may want to consider creating a new project with a minimal, complete, and verifiable example. That will help you verify your assumptions, and will likely track down the source of the problem. If it still fails, well then you'll be in much better shape for asking for help.
That was a long post :)
If I were you I would transfer all dateTimes in UTC format. The server basically must work with UTC time as far as I'm concerned. Transformation to client time must be applied at clients side. You can use momentjs library that proved to be very fine library for working with dates and times.
On client side do something like this
var date = {
utc: '/Date(1399407153971)/', //time that you have recieved
offset: 240
}
var localTime = moment.utc(date.utc).zone(date.offset).format('DD/MM/YYYY hh:mm');
I hope this helps
UPD
As Matt Johnson pointed out you can make it even shorter for current time zone.
var localTime = moment('/Date(1399407153971)/').format('DD/MM/YYYY hh:mm');
Hi I was trying send meeting invites through my asp.net MVC application. There was a requirement to show which timezone this invite was created as in following image. I tried various things as told by Microsoft support, neither of them worked.
As per Microsoft Exchange Server support's advice I created following.
TZID:Sri Jayawardenepura
BEGIN:STANDARD
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Sri Jayawardenepura:20140416T033000Z
DTSTAMP:20140327T113138Z
DTEND;TZID=Sri Jayawardenepura:20140416T060000Z
LOCATION: Board room
After adding TZID inside DTSTART, it is not coming as invite to gmail.
but following works fine as invitation both in outlook configured with Exchange Server and webmails like gmail.
TZID:Sri Jayawardenepura
BEGIN:STANDARD
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART:20140318T033000Z
DTSTAMP:20140327T122640Z
DTEND:20140318T060000Z
LOCATION: Board room
however that requirement of showing timezone where invite was created not fulfilled yet.
Can anyone help me. Thanks in advance.
If you look at http://www.kanzaki.com/docs/ical/dateTime.html it states that UTC time is identified by a Z suffix character as well as The TZID property parameter MUST NOT be applied to DATE-TIME properties whose time values are specified in UTC.
I would suspect that if you are using a timezone identifier that you need to remove the Z from the end of the date to get it to work properly.
EDIT: So, I was having troubles with timezones before as well, so I had only used UTC time, however I just got one to work with a timezone, so I hope this helps. Inside VTIMEZONE, you have a STANDARD, but you do not have a DTSTART inside the STANDARD. Again, quoting from the above link, The standard or daylight component MUST include the "DTSTART", "TZOFFSETFROM" and "TZOFFSETTO" properties.
It is not RFC5545 compliant but many calendars will expect a TZID to be compatible with the Olson DB and also may expect to have the calendar property X-WR-TIMEZONE set.
What I have seen is that when doing all of above you increase your calendar compatibility ratio.
I'm trying to get messages after a certain time-stamp, the way I've coded it was suggested by another programmer in this site:
GregorianCalendar date = new GregorianCalendar();
SearchTerm newer = new ReceivedDateTerm(ComparisonTerm.GT,date.getTime());
Message msgs[] = folder.search(newerThen);
The issue is that I get all the messages since the date, not the specific time. I was wondering if there is some work-around to emulate this. I mean, for an instance, if I want to get all the messages since today in the midday I would get those messages spicifically and not those ones received in today's morning.
Thanks in advance,
EDIT:
A new thought concerning to this: perhaps some date manipulation could do the job. I mean, comparing the minutes in the timestamp and filter programmatically those messages that don't fit the criteria. I know it's not the best way, but it could work.
PS: I'm using IMAP and trying to get mails from gmail, but I guess it should work no matter what the mail-server is.
Unfortunately, no. In this case, the IMAP protocol is being used by the JavaMail classes, and IMAP's SEARCH command takes only dates, not times (see the SINCE and SENTSINCE criteria).
You could use the setTime() method to query for some specific time.
Example:
setTime(timeInMilliseconds)