# Plucene::Document::DateSerializer - Utility functions for dealing with ... - perldoc - [phpMan]

## NAME
    [Plucene::Document::DateSerializer](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3ADateSerializer/markdown) - Utility functions for dealing with dates

## SYNOPSIS
            use [Plucene::Document::DateSerializer](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3ADateSerializer/markdown)
            my $field = [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown)->Text(
                    date => freeze_date([Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $t)
            );
            $doc->add($field);

## DESCRIPTION
    Dates and times in Plucene should be serialized using the "freeze_date" function so that the
    [Plucene::Search::DateFilter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ASearch%3A%3ADateFilter/markdown) can filter on them during future searches.

## SUBROUTINES
  freeze_date
            my $string = freeze_date([Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $t)

    This routine, exported by default, turns a "[Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown)" object into a string in a format
    expected by both Plucene and Lucene.

  thaw_date
            my [Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $t = [Plucene::Document::DateSerializer::thaw_date](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3ADateSerializer%3A%3Athawdate/markdown)($string)

    This routine is not exported, and is not used by the Plucene core. It is useful for debugging
    dates, and simply reverses the "freeze_date" operation.

