convertUtcToPlainDateTime
Signature
Section titled “Signature”convertUtcToPlainDateTime(value: string, options?: { timeZone?: string; }): stringimport { convertUtcToPlainDateTime } from "@northguild/gmt/utc/convert";Convert a UTC datetime string to a plain datetime string in the format “YYYY-MM-DDTHH:mm:ss”.
- Converts to specified timezone before extracting datetime.
- Defaults to UTC if no timezone specified.
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
UTC datetime string (e.g., “2024-02-29T00:00:00Z”) |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
timeZone? |
string |
— |
Returns
Section titled “Returns”plain datetime string in “YYYY-MM-DDTHH:mm:ss” format or “” on invalid input
Examples
Section titled “Examples”convertUtcToPlainDateTime("2024-02-29T00:00:00Z") // "2024-02-29T00:00:00"convertUtcToPlainDateTime("2024-02-29T00:00:00Z", { timeZone: "America/New_York" }) // "2024-02-28T19:00:00"convertUtcToPlainDateTime("invalid") // ""