1
0
forked from s421507/eOSP2
eOSP2/app/Common/Helpers.php

67 lines
2.1 KiB
PHP
Raw Normal View History

2020-07-07 03:17:30 +02:00
<?php
2020-07-11 20:56:21 +02:00
namespace App\Common;
class Helpers
{
public static function peselBirthdayDate($pesel){
$pesel = (String) $pesel;
$output = $pesel[2];
$output = (int)$output;
if( $output == 0 || $output == 1){
$year = '19'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 2 || $output == 3){
$year = '20'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 4 || $output == 5){
$year = '21'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 6 || $output == 7){
$year = '22'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 8 || $output == 9){
$year = '18'."".(String)$pesel[0]."".(String)$pesel[1];
}
if($output % 2 == 0 ){
$month = '0'."".(String)$pesel[3];
}else{
$month = '1'."".(String)$pesel[3];
}
$day = (String)$pesel[4]."".(String)$pesel[5];
return $day.".".$month.".".$year;
}
public static function peselBirthdayDateARRAY($pesel){
$pesel = (String) $pesel;
$output = $pesel[2];
$output = (int)$output;
if( $output == 0 || $output == 1){
$year = '19'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 2 || $output == 3){
$year = '20'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 4 || $output == 5){
$year = '21'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 6 || $output == 7){
$year = '22'."".(String)$pesel[0]."".(String)$pesel[1];
}elseif( $output == 8 || $output == 9){
$year = '18'."".(String)$pesel[0]."".(String)$pesel[1];
}
if($output % 2 == 0 ){
$month = '0'."".(String)$pesel[3];
}else{
$month = '1'."".(String)$pesel[3];
}
$day = (String)$pesel[4]."".(String)$pesel[5];
return array($day, $month, $year);
}
2020-07-15 23:58:07 +02:00
public static function textConvert($text){
return iconv('utf-8','iso-8859-2',$text);
}
2020-07-11 20:56:21 +02:00
}