search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Local Time Client Calendar but UTC Server Side

Asked by Hans Lindgren
9 years ago.

(2014-09-02 08:42 UTC)

Hello All,

I am using the 'ASP.NET WebForms 7.8 SP2 (build 7.8.3169)' Calendar object.
I have an issue with Local/UTC DateTime handling.
I have been going though all (most?) forum posts that seem to be of relevance but I haven't been able to figure this one out. Maybe because I am not very good with JavaScript (and most Local/UTC DateTime posts are also a few years old) they might have become obsolete?

I would like to have the Client facing Calendar to be using Local DateTime (showing the events not in UTC but in Local time) but I want to 'receive' (and handle) UTC DateTimes on my Server.
Ex: Say my Client is currently at UTC +02:00. (so time Local = 16:30, time UTC = 14:30)
Client creates an Event with newStart = 16:30, in his browser, and I would like to receive 14:30 in my EventMove event handler, Server Side.
Currently I use (in the Calendar.aspx):
EventMoveHandling="CallBack"
OnEventMove="DayPilotCalendar1_EventMove"
I 'receive' it Server side (in my Code Behid Calendar.aspx.cs) with the definition:
protected void DayPilotCalendar1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e) { }
In the example above, when my DayPilot.Web.Ui.Events.EventMoveEventArgs 'arrives' in my Server Side 'DayPilotCalendar1_EventMove', the newStart DateTime contains '16:30' (and not 14:30, as the UTC value should be).

I assume one solution could be to use an EventMove JavaScript (Client side), which modifies the DateTimes (?) to UTC and then passes them to DayPilotCalendar1_EventMove (Server Side) but I do not know how to write this JavaScript (if even possible). Also, I guess there might be other solutions too?

Then, as a followup question, I'd like to know how to do the reverse whenever I load Events and want to display them on the Client Side. I.e. my Events will now be stored as UTC and I need to 'transform' them to Local time once they reach the client.

Could someone help me please? :)

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.