NAME

PDK::Utils::Date - Date formatting utility class

VERSION

Version 1.0

SYNOPSIS

use PDK::Utils::Date;

my $date_utils = PDK::Utils::Date->new();

# Get formatted current date
my $formatted_date = $date_utils->getFormatedDate();

# Get formatted date for a specified Unix timestamp
my $formatted_date_with_time = $date_utils->getFormatedDate('yyyy-mm-dd', 1609459200);

METHODS

getFormatedDate($format, $time)

Get a formatted date string.

Parameters:

  • $format - Date format string (optional, default is 'yyyy-mm-dd hh:mi:ss')

  • $time - Unix timestamp (optional, default is current time)

Returns:

Formatted date string.

Exceptions:

Throws an exception if the format string does not contain valid time characters.

AUTHOR

WENWU YAN <968828@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2024 WENWU YAN. All rights reserved.

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