# hexTimeToDate

## Content

# Function: hexTimeToDate()

```ts
function hexTimeToDate(hexTime): Date;
```

Converts an ASN.1 DER-encoded time value (hex string) into a JavaScript Date.

The input may represent either UTCTime or GeneralizedTime and can be provided
as a raw value hex or a full ASN.1 TLV (Tag-Length-Value) hex string.

## Parameters

### hexTime

`string`

ASN.1 time value encoded as a hexadecimal string.

## Returns

`Date`

JavaScript Date object representing the UTC time.

## Example

```ts
const hex = "32303235303430363132333034355a"; // "20250406123045Z"
const date = hexTimeToDate(hex);
console.log(date.toISOString()); // "2025-04-06T12:30:45.000Z"
```
