I have following requirements: create a cookie for server domain that cookie will expire in x seconds say in 200 or 500 seconds. Problem is, that clients can lag as much as many minutes behind server. On server side I am setting cookie as setcookie($cooName,$cooVal,time()+500,"/"); but now if client computer is 500 seconds behind server, above code will effect into a cookie which will expire in 1000 seconds not 500 seconds. I was thinking to send client's time stamp to server and set cookie on that time. something like this: setcookie($cooName,$cooVal,$_GET['clientTS']+500,"/"); But if client is 500 seconds behind, and if I set such a cookie which is backdated it does not get set. How to achieve a time sync between client and server in case of cookie expiry?