'Time::Piece strptime has trouble with %X

I'm trying to parse the following data using Time::Piece->strptime() in perl v5.26:

my $str = "Mon Feb 21 02:54:49 IST 2022";
my $time_zone = substr($str, 20, 3);
my $date_time = Time::Piece->strptime($str, "%a %b %e %X $time_zone %Y");
print "Todays date/time is : $date_time";

But, when I execute the above code snippet, I get the following error:

Error parsing time at /usr/local/lib64/perl5/Time/Piece.pm line 598.

I'm not sure what is it that I'm missing out, any help will be really helpful.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source