Note that the "getter callback" and "setter callback" functions are only used by Entity metadata wrappers.
Not by entity_load or Views and such.
You can not use these to convert a different timestamp format in a database to a timestamp for use with the 'date' type unless you specifically create a wrapper for each of your entity instances.
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 "getter
callback" for the transformation.
Example of when callback is and is not used:
<?php
$entity = entity_load('myentity', array(1));
print $entity->day; // this gives 20110721 (from the database)
$item = entity_metadata_wrapper('myentity', $entity);
print $item->day->value(); // this gives 1311206400 (from the "getter callback")
?>In Views my day shows up as "08/21/1970 - 19:18" ...
so if someone can point me in the right direction to get my "days" as timestamps, I'm all ears.
How can i use "getter callback" to convert field from database stored as 'date' to timestamp for using for view? Or is there other way how to achieve this goal?
Juraj