+ Start a Discussion

get the date.now value in apex for a cookie

I need to get the button clicked time of the cookie inside an apex class.How can i achieve this??
<div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="mod" onclick="WriteCookie()">Close</button>                                                

      <script type="text/javascript">
            function WriteCookie()
               var now = system.now();
               cookievalue = escape(document.myform.customer.value) + ";"
               document.cookie="name=" + cookievalue;
               document.cookie = "expires=" + now.toUTCString() + ";"
               document.write ("Setting Cookies : " + "name=" + cookievalue );

How can i get the values inside an apex class including the time on which the button was clicked..
I think cookies are only supported in force.com sites and have to be set by the controller, not on the client.

This is a convoluted way of doing things though - if you want to send this information back to the controller why not use a hidden input field and let the platform do the lifting?