How do I calculate and permanently store a field value with code
I haven't done this myself before, so I cannot give really detailed instructions. I think I would do something like this:


Create a CCK text field in the content type(s) of your choice
Create a custom module and implement hook_form_alter
In your form alter function:

Give your CCK text field a #disabled property and set it to true (this will grey out the field so it cannot be edited)
Check if the field is already populated; if not, set the #default_value to the return value of the code in your question



This means that when Drupal builds the form, your custom module will disable the CCK field and put your content in it if that has not been done before. Because we're just populating a form field, all Drupaly stuff like the 'Display Fields' page will keep working.

I hope that helps.