Download the PHP package andegna/calender without Composer

On this page you can find all versions of the php package andegna/calender. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package calender

Andegna Calender From Ethiopia

Build Status StyleCI Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version Latest Unstable Version License FOSSA Status

SymfonyInsight

If you ever want to convert Ethiopian Calender to any other calendar system (like the Gregorian Calendar) this is the right (well-tested, well designed, high quality) package for you.

And by the way it also supports Amharic date formatting and much much more.

Basic Usage :hammer: ↑

Just to give you the 10,000-foot view (:airplane:) of the package.

Format it

Modify it

Get what you want :wink:

Requirement ↑

Andegna Calender requires php: >=7.0 with fire and blood :fire: :dragon:.

Please notice the name of this package is andegna/calender not andegna/calendar. It's a spelling mistake am not intending to fix.

Installation ↑

Andegna Calender utilizes Composer to manage its dependencies. So, before using this, make sure you have Composer installed on your machine.

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

If you never used composer before :flushed:, PLEASE read some intro here before you write any PHP code again.

Conversion ↑

Before we talk about calendar conversion, we better know how the Andegna\DateTime class works internally.

The Andegna\DateTime class is just a wrapper around PHP's built-in DateTime object and implements the PHP DateTimeInterface (OK! I lied on one part but trust me you don't wanna know that :smile:).

So Andegna\DateTime keep hold of the gregorian date and overrides the format, getTimestamp, add, 'diff' and such methods to give you an Ethiopian Calendar equivalent.

That's how it basically works.

From Ethiopian Date ↑

You can create an Andegna\DateTime from a given Ethiopia Date.

Let's "create"

From Timestamp ↑

Let's assume you have a timestamp from same were probably time() function or from some kind of database.

You can get Andegna\DateTime object like this

And you are done. You can also or pass a DateTimeZone object if you want too

From DateTime object ↑

If you already have a DateTime object, just give it to me :smile:

From date string ↑

This is not actually part of this package but someone probably having a hard time.

It generally boils down to two options. Do you know the format of the date string or not.

If you know the format of the date (you probably should) you can create a gregorian DateTime like this

To figure out the format please check this link or search for "PHP date function".

But if don't know the format is or don't care to figure it out just try to pass it to the DateTime constructor. It will "probably" figure out the format of the date string

From the system time ↑

You obviously can do this

To DateTime ↑

If you want the internal DateTime object (A.K.A convert to gregorian calendar).

Warning: the returned DateTime object is just a clone. So changes/modification to the returned object will not affect the Ethiopic date.

Low level Conversion ↑

If you are a geek like me, you are probably interested in Calendar coz it has Astronomy, Maths, and History.

How PHP calendar conversion works ↑

The calendar extension presents a series of functions to simplify converting between different calendar formats (except Ethiopian). The intermediary or standard it is based on is the Julian Day Count. The Julian Day Count is a count of days starting from January 1st, 4713 B.C. To convert between calendar systems, you must first convert to Julian Day Count, then to the calendar system of your choice. Julian Day Count is very different from the Julian Calendar! For more information on Julian Day Count, visit » http://www.hermetic.ch/cal_stud/jdn.htm. For more information on calendar systems visit » http://www.fourmilab.ch/documents/calendar/. Excerpts from this page are included in these instructions and are in quotes.

Those words are straight from the php docs.

So we need to implement two things to convert Ethiopian date to any other calendar.

  1. Convert Ethiopian Date To Julian Date Count
  2. Convert Julian Date Count To Ethiopian Date

If you wanna know the algorithms check out the only reliable resource at this link.

or check out my gist on GitHub at this link

From JDN ↑

To JDN ↑

Practical Example ↑

Now with those handy tools in our hand, we can convert Ethiopian date to any other date.

Let's convert to Jewish for example

Let's convert Julian Calendar to Ethiopian Calendar as a second example

List of supported calendars built into PHP

Click here to read more about those calendar function

Manipulation ↑

Warning ↑

The DateTime processor works on the internal gregorian DateTime. And manipulating months and years probably give an expected results.

Manipulating the internal date time ↑

You probably need to read about DateTimeInterval if you don't already know.

To give you a short summary, DateInterval implements the ISO 8601 durations.

Durations are a component of time intervals and define the amount of intervening time in a time interval. Durations are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W.

In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n].

Leading zeros are not required. The capital letters P, Y, M, W, D, T, H, M, and S are designators for each of the date and time elements and are not replaced.

For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds".

If you want to get the difference between dates

will output something like this

Formatting ↑

Introduction ↑

PHP built-in DateTime class has a format method used to format dates.

Read about the format method here

Read out the format characters here

If you read or already know how PHP date function works, you already know how exactly the formatting works.

Additional character formats ↑

Format Character Description Example
x Orthodox day name 1 => ልደታ, 12 => ሚካኤል
X Orthodox year name ማቴዎስ, ማርቆስ, ሉቃስ or ዮሐንስ
E Era in Amharic ዓ/ዓ or ዓ/ም
K Year in geez numeber ፳፻፱
V Day in geez numebr

Constants ↑

We have already defined some handy constants to print as it's custom in Ethiopia :heart: .

As you saw 3D, the constants all start with DATE_ and followed by ETHIOPIAN or GEEZ.

The one followed by GEEZ will return the day and the year in geez and the ETHIOPIAN with spit an ASCII numbers which we Ethiopian always use.

Lastly, if you append _ORTHODOX you will get the orthodox day name and orthodox year name.

Holidays ↑

Easter ↑

Calculating easter date feels like shooting a moving target. And everyone thinks calculating easter date is like impossible, some think like it's only possible if you are a deeply religious and some think it's decided by the church. But calculating easter date ( also called Computus) is not that much complex.

In the simplest form, Easter is the first Sunday following the full moon that follows the northern spring (vernal) equinox.

That sounds complex and was hard for the ages but not for the 21st century.

If you are interested in HOW it's calculated, I will post it on my upcoming blog. You can read this in the meanwhile.

Let's see how you can get the easter date for a given year

will output

Validators ↑

Validation. You probably need that too.

To check if Ethiopia date (given day, month and year) is valid you need to do all this

or you can use our validator

DateValidator

LeapYearValidator

Contributing ↑

Fork it
Create your feature branch (git checkout -b my-new-feature)
Commit your changes (git commit -am 'Add some feature')
Push to the branch (git push origin my-new-feature)
Create new Pull Request

License

FOSSA Status


All versions of calender with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
geezify/geezify-php Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package andegna/calender contains the following files

Loading the files please wait ....