I am generating a cookie that expires in 9 minutes, but when I want to observe it, it is 2 hours less than the creation time.
The cookie has been created at 09:10:00 am and in the expires of the image it says 07:17....
The code is:
if($cookies.get('uuid') != undefined ) {
$cookies.remove('uuid');
}
var dt = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (dt + Math.random()*16)%16 | 0;
dt = Math.floor(dt/16);
return (c=='x' ? r :(r&0x3|0x8)).toString(16);
});
var expiresValue = new Date(today);
expiresValue.setMinutes(today.getMinutes() + 9);
$cookies.put("uuid",uuid, {'expires': expiresValue});
I need the cookie to expire in 9 minutes from its creation, thank you very much!
The time is correct, it is simply displayed as Coordinated Universal Time (or Zulu time, hence the Z at the end), formerly known as GMT (Greenwich Mean Time):
You are in Spain, whose time during summer time is GMT +2 (two hours above universal time), therefore you will see that two hours are "subtracted" when displaying the values.