Is it possible to attach my own datetime class for using it in fields? For example, there is a situation, where I need to output date field in some another format. But this format is not supported by PHP.

For example, I want to output year value in Roman numerals format.
Or, I want to calculate year not from the Christmas, but from "the Creation of the world", from foundation of Rome ans so on. 
Or "the week" in my calendar doesn't contain 7 days, but it contains another quantity of them.

In this case, if I'm not mistaken, I should create new class inheriting it from DateTime class and there redefine method format or do something else.

Can I afterwards notice Drupal to it use my own DateTime class instead default ?
That is, for instance, I have created new DateTime field for some node type and I can set my date format for this field in the admin date settings page, in Views and so on.

Is it possible in Drupal 7 ?
And is it possible in Drupal 8 ?
If yes, how to do it ?
In your case, you do not need to define a new field type, you just need to write a new field formatter.

In Drupal 8, field formatters are used for displaying fields when displaying the parent entity (eg, a node view page) and when used in a view (even with field output).

Field formatters are easy to write in Drupal 8. In you case you just create a new plugin, and you can likely just extend one of the existing ones.  I suspect something like this would work for you

namespace Drupal\mymodule\Plugin\Field\FieldFormatter;

use Drupal\datetime\Plugin\Field\FieldFormatter\DateTimePlainFormatter;

/**
 * Plugin implementation of the 'Awesome' formatter for 'datetime' fields.
 *
 * @FieldFormatter(
 *   id = "mymodule_datetime_awesome",
 *   label = @Translation("Awesome"),
 *   field_types = {
 *     "datetime"
 *   }
 *)
 */
class AwesomeDateTimeFormatter extends DateTimePlainFormatter {

  /**
   * {@inheritdoc}
   */
  protected function formatDate($date) {
    // Do something awesome!
  }

}


Here, the DateTimePlainFormatter does all of the heavy lifting via inheritance and you just override the method that actually produces the date string to be whatever you need.  You can then use this on Manage Field Display, and other places you can choose a field formatter.

In Drupal 7, you can also just create a field formatter, but the process is more involved.  You would also need to create a views field output plugin, as Drupal 7 / Views 3 does not use field formatters with field output.