Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<juliantojdDate/Time>
^Calendar FunctionsLast updated: Mon, 26 Oct 2026

unixtojd

(PHP 4, PHP 5, PHP 7, PHP 8)

unixtojd — Convert Unix timestamp to Julian Day

Description

function unixtojd(?int $timestamp = null): int|false

Return the Julian Day for a Unix timestamp (seconds since 1.1.1970), or for the current day if no timestamp is given. Either way, the time is regarded as local time (not UTC).

Parameters

timestamp

A unix timestamp to convert.

Return Values

A julian day number as integer, or false on failure.

Errors/Exceptions

Throws a ValueError if timestamp is negative.

Changelog

Version Description
8.0.0 Now throws a ValueError if timestamp is negative. Previously, false was returned.
8.0.0 timestamp is nullable now.

See Also

  • jdtounix() - Convert Julian Day to Unix timestamp


<juliantojdDate/Time>
^Calendar FunctionsLast updated: Mon, 26 Oct 2026