Skip to content

Latest commit

 

History

History

Date

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Calendar

This class is for czech country.

Calendar::getDays

List of czech days. 1 => 'Pondělí' ...

Calendar::getMonths

List of czech month. 1 => 'Leden' ...

Calendar::nameOfDay

Accept int or object DateTime and return name of day.

Calendar::nameOfDay(1);
// Pondělí

Calendar::nameOfDay(new DateTime('1986-12-30'));
// Úterý

Calendar::nameOfMonth

Calendar::nameOfMonth(1);
// Leden

Calendar::nameOfMonth(new DateTime('1986-12-30'));
// Prosinec

Calendar::czech2DateTime

Czech date time format convert to DateTime object.

Calendar::czech2DateTime('01.01.2000');
Calendar::czech2DateTime('1.1.2000');
// return object DateTime('2000-01-01')

Calendar::czech2DateTime('01.01.2000 01:01:01');
Calendar::czech2DateTime('01.01.2000 1:1:1');
// return object DateTime('2000-01-01 01:01:01')

Calendar::czech2DateTime('01.01.2000 01:01');
// return object DateTime('2000-01-01 01:01:00')

Calendar::februaryOfDay

How many days have Fabruary in year.

Calendar::februaryOfDay(2012);
// 29

Calendar::februaryOfDay(2013);
// 28

Calendar::easter

Return Easter Monday as DateTime object.

Calendar::easter(); // is actualy year

Calendar::easter('2012');
// 2012-04-09

Calendar::getName

Return whose name's day.

Calendar::getName(new DateTime('2013-12-24')));
// Adam a Eva
class MyDatetime extends \DateTime
{

	public function __toString()
	{
		return $this->format('Y-m-d H:i:s');
	}
}

DateTimeString::setClass(MyDatetime::class);

DateTime

Try to create object DateTime from string fragment.

use h4kuna\DataType\Date\Parser;

Parser::fromString('1'); // today 01:00:00
Parser::fromString('1:20'); // today 01:20:00
Parser::fromString('1:20:30'); // today 01:20:30
Parser::fromString('+1'); // now +1 hour
Parser::fromString('-1'); // now -1 hour
Parser::fromString('-1.5'); // now -1 hour and -30 minutes 
Parser::fromString('-1:30'); // now -1 hour and -30 minutes
Parser::fromString('6-13 12:20'); // this year, 6. month, 13. day, time 12:20:00

Sleep

Sleep in milliseconds

use h4kuna\DataType\Date\Sleep;

Sleep::seconds(0.5); // sleep 0.5s
Sleep::milliseconds(500); // sleep 0.5s