# `FUN_GET_DATE_KT_ADD` (function)

> 根据传入时间获取时间


- **Type:** FUNCTION
- **Returns:** `varchar(255)`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_tCStartTime` | `varchar(200)` |
| 2 | IN | `p_sStartDate` | `varchar(200)` |
| 3 | IN | `p_sEndDate` | `varchar(200)` |
| 4 | IN | `p_tAddTime` | `varchar(200)` |
| 5 | IN | `p_addMinut` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTION `FUN_GET_DATE_KT_ADD`'`._

## Narrative

**Business context:** Production-scheduling break-window push helper for a planning interval. If the planned interval crosses a configured break window (e.g. lunch 12:00–13:00) the running end-time gets pushed by the window length so the break doesn't count as production time. "KT" matches the `kt`/`ukt` naming on the sister functions ([`FUN_GET_DATE_UKT`](FUN_GET_DATE_UKT.md) family). Day-shift companion of [`FUN_GET_DATE_UKT_ADD`](FUN_GET_DATE_UKT_ADD.md), which covers the night-shift break window.

**What it does:** defaults the window to `23:30:00 → 00:30:00` if unset. Computes `p_i = (p_tCStartTime ≤ today_at_sStartDate)` and `p_j = (p_tAddTime > today_at_sStartDate)`. If both are true (i.e. the interval straddles the break window's start), adds `p_addMinut` minutes to `p_tAddTime`. Returns the (possibly adjusted) `p_tAddTime`.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master sSqlStr, gdsmodule hooks, other routines, exhaustive xly-src grep, dynamic-dispatch search) — only the source file `FUN_GET_DATE_KT_ADD.sql` itself was found. Sister `FUN_GET_DATE_UKT_ADD` is live in [`FUN_GET_CALCPLAN_DATE_END`](FUN_GET_CALCPLAN_DATE_END.md); this `KT_ADD` form looks like a leftover companion — candidate for maintainer audit.
