Hi, <br><br>I have same problem as here: <a href="http://drupal.org/node/1021466#comment-4766902">http://drupal.org/node/1021466#comment-4766902</a><br><br><a href="http://drupal.org/node/1021466#comment-4766902" class="active">Callbacks are only used by wrappers</a><br>
<div class="comment-heading">
    <div class="submitted">Posted by <a href="http://drupal.org/user/892998" title="View user profile.">JvE</a> on <em>July 22, 2011 at 10:18am</em>        </div>
  </div>
  <div class="content">
    <div class="clear-block">
            <p>Note that the &quot;getter callback&quot; and &quot;setter callback&quot; functions are <em>only</em> used by Entity metadata wrappers.<br>
Not by entity_load or Views and such.</p>
<p>You can not use these to convert a different timestamp format in a 
database to a timestamp for use with the &#39;date&#39; type unless you 
specifically create a wrapper for each of your entity instances.</p>
<p>I tried to get my (int)yyyymmdd values from the database to show up 
in Views as dates and mistakenly thought I could use the &quot;getter 
callback&quot; for the transformation.<br>
Example of when callback is and is not used:<br></p><div class="codeblock"><code><span style="color:#0000bb">&lt;?php<br>    $entity </span><span style="color:#007700">= </span><span style="color:#0000bb">entity_load</span><span style="color:#007700">(</span><span style="color:#dd0000">&#39;myentity&#39;</span><span style="color:#007700">, array(</span><span style="color:#0000bb">1</span><span style="color:#007700">));<br>
    print </span><span style="color:#0000bb">$entity</span><span style="color:#007700">-&gt;</span><span style="color:#0000bb">day</span><span style="color:#007700">; </span><span style="color:#ff8000">// this gives 20110721 (from the database)<br>
    </span><span style="color:#0000bb">$item </span><span style="color:#007700">= </span><span style="color:#0000bb">entity_metadata_wrapper</span><span style="color:#007700">(</span><span style="color:#dd0000">&#39;myentity&#39;</span><span style="color:#007700">, </span><span style="color:#0000bb">$entity</span><span style="color:#007700">);<br>
    print </span><span style="color:#0000bb">$item</span><span style="color:#007700">-&gt;</span><span style="color:#0000bb">day</span><span style="color:#007700">-&gt;</span><span style="color:#0000bb">value</span><span style="color:#007700">(); </span><span style="color:#ff8000">// this gives 1311206400 (from the &quot;getter callback&quot;)<br>
</span><span style="color:#0000bb">?&gt;</span></code></div><br>
In Views my day shows up as &quot;08/21/1970 - 19:18&quot; ...<br>
so if someone can point me in the right direction to get my &quot;days&quot; as timestamps, I&#39;m all ears. </div><div class="clear-block"><br></div><div class="clear-block"><br></div><div class="clear-block">How can i use &quot;getter callback&quot; to convert field from database stored as &#39;date&#39; to timestamp for using for view? Or is there other way how to achieve this goal? </div>
<div class="clear-block"><br></div><div class="clear-block">Juraj</div></div><div><br></div>-- <br>Juraj Chlebec aka Havran<br><a href="http://www.svoji.sk">http://www.svoji.sk</a><br>