I am using fullcalendar for a project of mine. I have a strange problem that keeps bugging me. When I export an event, I want to get it in timestamp format, which is OK. the problem is when I try to convert it to ISO format using Date.toISOString function, it gives me the time 2 hours earlier. I think it is a problem of my timezone, because I posted my timestamp on http://www.unixtimestamp.com/
and it gives me the right time, but when I do it in my browser, it gives me the date and time with 2 hours earlier. I can't seem to figure it out. I googled a lot for a solution, but nothing so far. Does anybody have a clue?
Asked
Active
Viewed 826 times
-1

user2435860
- 778
- 3
- 9
- 22
-
Please show some code so we can see what you are trying. – Matt Johnson-Pint Jun 16 '13 at 17:50
1 Answers
1
toISOString
will give you a string to represent the time in UTC. If you look at the result closely enough, you can find there is a "Z" in the end, which means the timezone is UTC.

Ye Liu
- 8,946
- 1
- 38
- 34
-
OK, I looked up to it. But how cand I get my result? Because I want to insert the date in a string format into mysql via php. – user2435860 Jun 16 '13 at 17:06
-
@user2435860 a quick search give me this: http://stackoverflow.com/questions/1349280/storing-datetime-as-utc-in-php-mysql – Ye Liu Jun 16 '13 at 17:11
-
@user2435860 You need to give us more information. What column type are you using to store the date in mysql? DATETIME or TIMESTAMP? Do you store the date in UTC or local time? How do you use the result of `toISOString`, to display or send to server? – Ye Liu Jun 16 '13 at 17:56