rokojori_action_library/Runtime/Time/DateTime/ISOTimeStamp.cs

38 lines
730 B
C#
Raw Normal View History

2025-07-14 10:35:37 +00:00
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
namespace Rokojori
{
2025-12-10 14:17:07 +00:00
[GlobalClass]
public partial class ISOTimeStamp:Resource
2025-07-14 10:35:37 +00:00
{
public string value;
public static ISOTimeStamp Create( string value )
{
var t = new ISOTimeStamp();
t.value = value;
return t;
}
public static DateTimeOffset ToDate( ISOTimeStamp stamp )
{
return DateTimeOffset.Parse( stamp.value );
}
public static ISOTimeStamp FromDate( DateTimeOffset date )
{
return Create( date.ToString("o") );
}
public static ISOTimeStamp Now()
{
return ISOTimeStamp.FromDate( DateTimeOffset.Now );
}
}
}