Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplay time by using timeZonehelper class Cakephp
    primarykey
    data
    text
    <p>i am newbie in Cakephp working on a Cakephp 2.x and have never worked on a timezone before.. i am using this helper class </p> <p><a href="http://bakery.cakephp.org/articles/MarkAlanEvans/2009/12/17/updated-timezone-helper" rel="nofollow">http://bakery.cakephp.org/articles/MarkAlanEvans/2009/12/17/updated-timezone-helper</a></p> <p>i am succesfully saving the time in my database.. but i dont know how can i convert and print the time and date .. </p> <p>i have seen the documentation but nothing works for me as in documentation they are saving the time in <strong>User</strong> table but i am saving the time in <strong>Userinfo</strong> table so please help me in this ... </p> <p>here is my <strong>controller</strong> and <strong>view</strong> code </p> <pre><code> echo $this-&gt;Timezone-&gt;select('timezone'); **Controller** if($this-&gt;request-&gt;is('post')) { $id = $this-&gt;Auth-&gt;User('idUser'); $timezone = $this-&gt;request-&gt;data['Userinfo']['timezone']; $this-&gt;Userinfo-&gt;updateAll( array('Userinfo.timezone' =&gt; "'$timezone'"), array('Userinfo.User_id' =&gt; $id) ); }else { $id = $this-&gt;Auth-&gt;User('idUser'); $oldtimezone = $this-&gt;Userinfo-&gt;field( 'timezone', array('Userinfo.User_id' =&gt; $id)); } $this-&gt;request-&gt;data['Userinfo']['timezone'] = $oldtimezone; } } </code></pre> <p>and also if that possible for you to tell me that after picking the time from the database i want to pick the date from the server and then convert on this gmt i have saved in database ..help me if you know how to pick date from server and convert from gmt in Cake in this link they have shown thay of formating and how to display the time </p> <pre><code>echo $time-&gt;format('M d, Y', $post['created'], null, $auth['User']['timezone']); </code></pre> <p>so i want to try this according to my webapp</p> <pre><code> echo $time-&gt;format('M d, Y', null, null, ['Userinfo']['timezone']); </code></pre> <p>it is giving me an error .. dont know the correct syntax </p> <p>and for display </p> <pre><code>echo $timezone-&gt;display(['Userinfo']['timezone']); //this has also given me an error </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload