jalali_utils
jalali_utils · Convert Gregorian dates and timestamps to Jalali calendar values.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101016 | jalali_utils | jalali_utils | 0.0.1 | TIME | Unknown | C |
PostgreSQL · 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
jalali_utils converts Gregorian PostgreSQL dates and timestamps to Solar Hijri (Jalali) text or integer date parts. The timestamp overloads always interpret the instant in Asia/Tehran; they do not use the session TimeZone.
Core Workflow
format_jalali(timestamptz, boolean) returns YYYY/MM/DD HH:MM:SS when the optional flag is true and date-only text when false. format_jalali(date) always returns date-only text.
Function Index
format_jalali(timestamptz, boolean DEFAULT true)formats an instant in Tehran civil time.format_jalali(date)converts a Gregorian calendar date.jalali_part(text, timestamptz)extracts a Jalali field from an instant in Tehran time.jalali_part(text, date)extracts a Jalali field from a date.
Accepted fields are year, month, day, hour, minute, second, doy, dow, quarter, decade, and century. dow uses Saturday as zero.
Caveats
Version 0.0.1 returns formatted values as text, not a sortable or validated Jalali data type. Sort and compare the original PostgreSQL date or timestamp, and use formatting only at presentation boundaries. The hard-coded Tehran zone means timestamp results can cross a calendar-day boundary relative to UTC or the session zone. Verify leap-day, daylight-saving history, negative/infinite dates, and supported PostgreSQL versions for the exact binary before relying on the conversion in financial or legal workflows.