PHPackages                             adrian-cid/julian-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. adrian-cid/julian-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

adrian-cid/julian-converter
===========================

A PHP library for converting dates between the Gregorian calendar and Julian dates, with support for time precision down to seconds. Ideal for date manipulations, calendar conversions, and astronomical calculations.

v1.0.1(1y ago)0131GPL-3.0PHPPHP &gt;=7.0

Since Oct 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/adrian-cid/julian-converter)[ Packagist](https://packagist.org/packages/adrian-cid/julian-converter)[ Docs](https://github.com/adrian-cid/julian-converter)[ RSS](/packages/adrian-cid-julian-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Julian Date Converter
=====================

[](#julian-date-converter)

[![Latest Stable Version](https://camo.githubusercontent.com/e9b210ed562efce208d208ad46ebbf9fd470d371b3348b7ad000134edd1aab3e/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e2d6369642f6a756c69616e2d636f6e7665727465722f762f737461626c65)](https://packagist.org/packages/adrian-cid/julian-converter)[![Total Downloads](https://camo.githubusercontent.com/742527b43b59a7998931f3296b4d7a1ec9c78f585503d730f289f74de92ba3ff/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e2d6369642f6a756c69616e2d636f6e7665727465722f646f776e6c6f616473)](https://packagist.org/packages/adrian-cid/julian-converter)[![License](https://camo.githubusercontent.com/b7093ff9c4c4951cb65fdc858b5b71758177aea463e8591ee9b96f4054c283f9/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e2d6369642f6a756c69616e2d636f6e7665727465722f6c6963656e7365)](https://packagist.org/packages/adrian-cid/julian-converter)

**Julian Date Converter** is a simple PHP library for converting dates between the **Gregorian** calendar and **Julian** dates, with precision down to seconds. It handles both conversions, taking into account the fractional day for exact time calculations.

Installation
------------

[](#installation)

You can install this package using [Composer](https://getcomposer.org/).

```
composer require adrian-cid/julian-converter
```

Requirements
------------

[](#requirements)

- PHP 8.2 or higher.

Usage
-----

[](#usage)

### 1. Convert Gregorian Date to Julian Date

[](#1-convert-gregorian-date-to-julian-date)

You can convert any `DateTime` object from the Gregorian calendar to its equivalent Julian Date. The result will be a `float` representing the Julian Date, including the fractional day for hours, minutes, and seconds.

```
use AdrianCid\Calendar\JulianConverter;

// Create a DateTime object with the desired date and time.
$gregorian_date = new \DateTime('2024-10-02 15:30:00');

// Instantiate the converter and convert the Gregorian date to Julian date.
$converter = new JulianConverter();
$julian_date = $converter->convertGregorianToJulianDate($gregorian_date);

echo "The Julian Date is: " . $julian_date; // Output: The Julian Date is: 2460111.145833
```

### 2. Convert Julian Date to Gregorian Date

[](#2-convert-julian-date-to-gregorian-date)

To convert a Julian Date back to the Gregorian calendar, use the `convertJulianToGregorianDate()` method. The result will be a `DateTime` object representing the equivalent Gregorian date and time.

```
use AdrianCid\Calendar\JulianConverter;

// Example Julian date.
$julian_date = 2460111.145833;

// Convert the Julian date back to a Gregorian DateTime object.
$gregorian_date = $converter->convertJulianToGregorianDate($julian_date);

echo "The Gregorian Date is: " . $gregorian_date->format('Y-m-d H:i:s');
// Output: The Gregorian Date is: 2024-10-02 15:30:00
```

Methods
-------

[](#methods)

### `convertGregorianToJulianDate(\DateTime $gregorian_date): float`

[](#convertgregoriantojuliandatedatetime-gregorian_date-float)

Converts a `DateTime` object (Gregorian date) into a Julian Date as a `float`. The fractional part of the Julian Date reflects the time of day.

- **Parameters**:

    - `\DateTime $gregorian_date`: The date to be converted (Gregorian).
- **Returns**:

    - `float`: The Julian Date with the fractional day included.

### `convertJulianToGregorianDate(float $julian_date): \DateTime`

[](#convertjuliantogregoriandatefloat-julian_date-datetime)

Converts a Julian Date to a `DateTime` object (Gregorian date).

- **Parameters**:

    - `float $julian_date`: The Julian date to be converted.
- **Returns**:

    - `\DateTime`: The equivalent Gregorian date and time.

License
-------

[](#license)

This package is licensed under the GPL-3.0 License. See the [LICENSE](LICENSE) file for more details.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

587d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.2

v1.0.1PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4230d2f5e9aa2c90d367d47f1d7ea0633155be0b28b401ac615fbd21501d0ed3?d=identicon)[adrian-cid](/maintainers/adrian-cid)

---

Top Contributors

[![adrian-cid](https://avatars.githubusercontent.com/u/9852636?v=4)](https://github.com/adrian-cid "adrian-cid (3 commits)")

---

Tags

datetimecalendardate-conversiongregorianjulianTime conversiondate manipulationastronomyphp utilitiesphp dateJulian DateDate CalculatorTime CalculationsDate AlgorithmsGregorian to JulianCalendar Conversion

### Embed Badge

![Health badge](/badges/adrian-cid-julian-converter/health.svg)

```
[![Health](https://phpackages.com/badges/adrian-cid-julian-converter/health.svg)](https://phpackages.com/packages/adrian-cid-julian-converter)
```

###  Alternatives

[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[fisharebest/ext-calendar

Implementation of the Arabic (Hijri), French, Gregorian, Jewish, Julian and Persian (Jalali) calendars. Also provides a replacement for the PHP ext/calendar extension.

36473.2k8](/packages/fisharebest-ext-calendar)[phpu/calendar

中国日历，通过天文计算和民间推算方法，准确计算出公历-1000年至3000年的农历、干支、节气等，同时支持多配置、多语言、多时区。

201.7k](/packages/phpu-calendar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
