Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->isBefore()

Check whether the current date occurs chronologically before another specified date.

The isBefore method evaluates whether the current NepaliDate instance occurs earlier in time than another provided date. It takes into account both date and time components down to millisecond accuracy.


Import

use NepaliDateLibrary\NepaliDate;

Signature

public function isBefore(NepaliDate $date): bool;

Parameters

ParameterTypeRequiredDescription
$dateNepaliDateYesTarget date to compare against.

Return Value

  • Type: bool
  • Description: Returns true if current date is chronologically earlier than $date.

Example

use NepaliDateLibrary\NepaliDate;

$d1 = new NepaliDate('2081-01-01');
$d2 = new NepaliDate('2081-01-15');

var_dump($d1->isBefore($d2)); // true
var_dump($d2->isBefore($d1)); // false

Advertisement

On this page