Formattazione perl datetime

Esempi di codice

2
0

formattazione perl datetime

# For Perl only

# syntax
use POSIX;
use Time::Piece;
my $CurTime = localtime(); # <-- Format: Day Month  Date HH:MM:SS (ei: Thu May  7 08:45:52 2020)
my $FormattedVal = $CurTime->strftime('<FormatOfDateTime>');

# example - Copy paste everything below this line and run it
use POSIX;
use Time::Piece;
my $CurTime = localtime();

my $Formatted_Year = $CurTime->strftime('%Y');
my $Formatted_Month = $CurTime->strftime('%m');
my $Formatted_Date = $CurTime->strftime('%d');
my $Formatted_Time = $CurTime->strftime('%X');
my $Formatted_Together = $CurTime->strftime('Date:%Y-%m-%d Time:%X');

print "[Formatted_Year-->>$Formatted_Year]\n";
print "[Formatted_Month-->>$Formatted_Month]\n";
print "[Formatted_Date-->>$Formatted_Date]\n";
print "[Formatted_Time-->>$Formatted_Time]\n";
print "[Formatted_Together-->>$Formatted_Together]\n";

Pagine correlate

Pagine di esempio simili

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................