---
name: "parseSecond"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "time"
---

## parseSecond

> [VERSION] @ray-js/panel-sdk >= 1.0.0

### Description

Parse seconds into a [HH, MM, SS] string array

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `t` | `number` | Yes | Total seconds |

### Return Value

Type: `string[]`

An array of three two-digit strings representing [hours, minutes, seconds]

### Examples

#### Basic usage

```ts
import { utils } from '@ray-js/panel-sdk';

const { parseSecond } = utils;

parseSecond(111);     // ['00', '01', '51']
parseSecond(3661);    // ['01', '01', '01']
parseSecond(3333333); // ['25', '55', '33']
```

---
name: "parseHour12"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "time"
---
## parseHour12

> [VERSION] @ray-js/panel-sdk >= 1.0.0

### Description

Format seconds as a 12-hour time string

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `second` | `number` | Yes | Total seconds; values beyond one day (86400 seconds) are taken modulo |

### Return Value

None


### Examples

#### Basic usage

```ts
import { utils } from '@ray-js/panel-sdk';

const { parseHour12 } = utils;

parseHour12(111);     // '12:01 AM'
parseHour12(3333333); // '01:55 PM'
parseHour12(43200);   // '12:00 PM'
```

---
name: "stringToSecond"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "time"
---
## stringToSecond

> [VERSION] @ray-js/panel-sdk >= 1.0.0

### Description

Parse a time string into total seconds

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `timeStr` | `string` | Yes | A colon-separated time string in 'HH:MM' or 'HH:MM:SS' format |

### Return Value

None


### Examples

#### Basic usage

```ts
import { utils } from '@ray-js/panel-sdk';

const { stringToSecond } = utils;

stringToSecond('11:30');    // 690
stringToSecond('22:11:30'); // 79890
stringToSecond('01:00');    // 60
```

---
name: "dateToTimer"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "time"
---
## dateToTimer

> [VERSION] @ray-js/panel-sdk >= 1.0.0

### Description

Convert a date string to a Unix timestamp (seconds)

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `dateString` | `string` | Yes | A date string in 'YYYYMMDD' or 'YYYYMMDD HH:MM:SS' format |

### Return Value

None


### Examples

#### Basic usage

```ts
import { utils } from '@ray-js/panel-sdk';

const { dateToTimer } = utils;

dateToTimer('20110801');          // 1312128000 (depends on time zone)
dateToTimer('20110801 12:11:11'); // 1312171871 (depends on time zone)
```

---
name: "dateFormat"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "time"
---
## dateFormat

> [VERSION] @ray-js/panel-sdk >= 1.0.0

> 💡 M (month), d (day), h (hour), m (minute), s (second), and q (quarter) support 1–2 placeholders; y (year) supports 1–4 placeholders; S (millisecond) supports only 1 placeholder.

### Description

Format a Date object into a date string in the specified format

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `fmt` | `string` | Yes | A format template string supporting placeholders y (year), M (month), d (day), h (hour), m (minute), s (second), q (quarter), S (millisecond) |
| `date` | `Date` | Yes | The Date object to format |

### Return Value

None


### Examples

#### Basic usage

```ts
import { utils } from '@ray-js/panel-sdk';

const { dateFormat } = utils;

const date = new Date('2026-07-02 08:09:04.423');
dateFormat('yyyy-MM-dd hh:mm:ss.S', date); // '2026-07-02 08:09:04.423'
dateFormat('yyyy-M-d h:m:s.S', date);      // '2026-7-2 8:9:4.423'
dateFormat('MM/dd/yyyy', date);             // '07/02/2026'
```

---
name: "timezone"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "time"
---
## timezone

> [VERSION] @ray-js/panel-sdk >= 1.0.0

### Description

Get the current system time zone offset string

### Parameters

None


### Return Value

None


### Examples

#### Basic usage

```ts
import { utils } from '@ray-js/panel-sdk';

const { timezone } = utils;

const tz = timezone(); // e.g., '+08:00' (China Standard Time)
```
