Methods
date->parse()
Parse a formatted Bikram Sambat date string and update the current date instance in place.
The parse method parses a Bikram Sambat date string and updates the coordinates of the current NepaliDate instance in place. It supports various delimiter styles including slashes, dots, and hyphens, recalculating the underlying timestamp upon successful parsing.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function parse(string $dateString): void;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$dateString | string | Yes | Formatted Bikram Sambat date string (e.g. '2081-07-15'). |
Return Value
- Type:
void - Note: Mutates the current instance in place.
Example
use NepaliDateLibrary\NepaliDate;
$date = new NepaliDate();
$date->parse('2081-07-15');
echo $date->format('YYYY-MM-DD'); // "2081-07-15"Related
NepaliDate Constructor: Create instances from strings.date->format(): Format dates to strings.
Advertisement
date->setDate()
Set the day of the month on a NepaliDate instance and recalculate its timestamp.
date->addDays()
Add or subtract a specified number of days to a NepaliDate instance with automatic month and year rollover.