web analytics

Oracle: converting timestamp to date

Here is the method to display timestamp in the convenient format:

SELECT TO_CHAR (SYSTIMESTAMP, ‘YYYY-MM-DD HH24:MI:SS’) s_date FROM DUAL;

Simple conversion of the timestamp:

SELECT CAST(SYSTIMESTAMP AS DATE) x_date FROM DUAL;

Unix: get the file date

ls -1 | cpio -o | cpio -ivt | awk ‘{print $NF, $(NF-1), $(NF-4), $(NF-3) }’

Warning: I/O expensive for the large files!

Perl:

@a = localtime((stat($my_file))[9]); $a[4]++; printf "%02d%02d%02d",@a[5,4,3];

Calculating the date of Easter

The easiest way is to use specialized package (like Date::Calc). If You need standalone function, the following method could be used.

#!/usr/bin/perl $year=$ARGV[ 0 ]; $isJulian=(defined($ARGV[ 1 ]) && $ARGV[ 1 ] eq ‘julian’); $isOrthodox=(defined($ARGV[ 1 ]) && $ARGV[ 1 ] eq ‘orthodox’); my ( $G , $C , $H, $I, $J , $L ); […]