Skip to content

API Host ScriptDate

Liu.Yandong.Hanks edited this page Aug 19, 2026 · 3 revisions

ScriptDate

基于 DateTimeOffset 的脚本日期包装类型。

Script date wrapper over DateTimeOffset.

命名空间:AuroraScript.Runtime.Types。类型:class。

Namespace: AuroraScript.Runtime.Types. Kind: class.

返回 .NET Host API 参考

Back to .NET Host API Reference

用途

Purpose

ScriptDate 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。

Script date wrapper over DateTimeOffset.

简单示例

Simple Example

下面是 ScriptDate 的最小使用方式。

A minimal use of ScriptDate.

var date = new ScriptDate(
    new DateTimeOffset(2026, 8, 19, 0, 0, 0, TimeSpan.Zero));

Console.WriteLine(date.Format("yyyy-MM-dd")); // 2026-08-19

成员

Members

Constructor

签名

  • ScriptDate(DateTime date)
  • ScriptDate(DateTimeOffset dateTimeOffset)
  • ScriptDate(long ticks)

创建 ScriptDate 实例。

Use the member according to its public signature.

Parameters:

  • date
    按签名提供的 DateTime 参数。

    The DateTime parameter required by the signature.

  • dateTimeOffset
    按签名提供的 DateTimeOffset 参数。

    The DateTimeOffset parameter required by the signature.

  • ticks
    按签名提供的 long 参数。

    The long parameter required by the signature.

Returns

新建的 ScriptDate 实例。

A new ScriptDate instance.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

var value = new ScriptDate(/* 参数 */);

DateTimeOffset DateTime

读取 DateTime 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 DateTimeOffset

Returns DateTimeOffset.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptDate value = /* 从宿主 API 获取实例 */;
var current = value.DateTime;

Components

签名

  • int Year
  • int Month
  • int Day
  • int Hour
  • int Minute
  • int Second
  • int Millisecond
  • DayOfWeek DayOfWeek
  • int DayOfYear
  • long Ticks

读取 Components 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回值取决于所选重载;请查看签名。

Return value depends on the selected overload; see the signatures.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptDate value = /* 从宿主 API 获取实例 */;
var current = value.Components;

string Format(string format = null)

调用 Format 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • format
    按签名提供的 string 参数。

    The string parameter required by the signature.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptDate value = /* 从宿主 API 获取实例 */;
var result = value.Format(/* format */);

Clone this wiki locally