Custom field in views, dates ande serializing

When using views, sometimes you just can't get output you want for the fields you are outputing, then you use Custom field module. Custom field let's you use PHP as field and get all the date from other field with $data array (output it with print_r ($data); to see what is in there) So i wanted to output date field with a condition. Since profile module and its date field doesn't let you enter blank date you have to display something, a 1.1.1900 would be displayed if nothing is entered. To fix this you make a custom field where nothing is outputed if this date is entered.

Also there is another twist, if you used "date" ad content field type you would have serialized date in a format a:3:{s:3:"day";s:1:"1";s:5:"month";s:1:"1";s:4:"year";s:4:"1900";} so you would need to unserialize it and then output date. If you have timestamp you just use format_date function and you don't have much problem. With this you go


profile_values_profile_rodjenje_value);

if($date['year']!=1900){
print $date['month'].'.'.$date['day'].'.'.$date['year'].';';
}
?>

Put this in your custom field and you are good to go, you have date outputed only if someone entered informaton for it.