NAME

DBIO::MSSQL::Storage::DateTime::Format - DateTime parser for MSSQL date, time, datetime, smalldatetime, datetime2 and datetimeoffset columns

VERSION

version 0.900007

METHODS

parse_smalldatetime

my $dt = $class->parse_smalldatetime($string);

Parses a smalldatetime string (minute precision) into a DateTime.

format_smalldatetime

my $string = $class->format_smalldatetime($dt);

Formats a DateTime for a smalldatetime column.

parse_datetime2

my $dt = $class->parse_datetime2('2026-10-25 13:14:15.1234567');

Parses a datetime2 string with up to seven fractional digits into a floating DateTime; nothing below the fraction is lost.

format_datetime2

my $string = $class->format_datetime2($dt);   # 20261025 13:14:15.1234567

Formats a DateTime for a datetime2 column with seven fractional digits, in the form that no DATEFORMAT or language of the session changes.

parse_datetimeoffset

my $dt = $class->parse_datetimeoffset('2026-10-05 13:14:15.1234567 +02:00');

Parses a datetimeoffset string into a DateTime that carries the offset (a fixed-offset time zone). A value that comes with Z (DBD::Sybase from TDS 7.3 hands the instant over in UTC) has the offset +00:00.

format_datetimeoffset

my $string = $class->format_datetimeoffset($dt);   # 20261005 15:14:15.1234567 +02:00

Formats a DateTime for a datetimeoffset column: the wall clock of the value in its own time zone and the offset it has at that instant (a value in an Olson zone writes the offset of that moment). A floating value is written as +00:00.

parse_time

my $dt = $class->parse_time('13:14:15.1234567');

Parses a time string with up to seven fractional digits (or none, for time(0)). The date of the result is 1970-01-01.

format_time

my $string = $class->format_time($dt);   # 13:14:15.1234567

Formats the time of day of a DateTime with seven fractional digits.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.