# What's the right format for creating a Iso8601DateTime attribute?

**URL:** <https://forum.sensmetry.com/t/whats-the-right-format-for-creating-a-iso8601datetime-attribute/432>\
**Category:** How-to Guides\
**Tags:** resolved\
**Created:** [April 1, 2026, 12:31am UTC](https://forum.sensmetry.com/t/whats-the-right-format-for-creating-a-iso8601datetime-attribute/432 "2026-04-01T00:31:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Karban](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/robert_karban/32/119_2.png) [@Robert\_Karban](https://forum.sensmetry.com/u/Robert_Karban)\
**Post date:** [April 1, 2026, 12:31am UTC](https://forum.sensmetry.com/t/whats-the-right-format-for-creating-a-iso8601datetime-attribute/432/1 "2026-04-01T00:31:51Z")

</div>

Hi,

I’m getting a validation error for:

```auto
attribute dateOfBirth: Iso8601DateTime = new Iso8601DateTime("1926-04-03T00:00:00");

attribute dateOfDeath: Iso8601DateTime = new Iso8601DateTime("1967-01-27");

```

ScalarValues::String does not conform to Time::Iso8601DateTimeEncoding

Looks like I can’t pass a string.

Thanks,

Robert

---

<div class="post-metadata">

**Author:** ![Adam\_Layne](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/adam_layne/32/230_2.png) [@Adam\_Layne](https://forum.sensmetry.com/u/Adam_Layne)\
**Post date:** [April 1, 2026, 12:49am UTC](https://forum.sensmetry.com/t/whats-the-right-format-for-creating-a-iso8601datetime-attribute/432/2 "2026-04-01T00:49:06Z")

</div>

Hi Robert,

This lint is telling you that you must construct an `Iso8601DateTimeEncoding` to create an `Iso8601DateTime`. See the standard library documentation at [SysML-v2-Release/sysml.library/Domain Libraries/Quantities and Units/Time.sysml at 123ef05f5bf237bf277093182eb34a967fccdabf · Systems-Modeling/SysML-v2-Release · GitHub](https://github.com/Systems-Modeling/SysML-v2-Release/blob/123ef05f5bf237bf277093182eb34a967fccdabf/sysml.library/Domain%20Libraries/Quantities%20and%20Units/Time.sysml#L201-L216) .

For ways to create and not create an `Iso8601DateTime`, look at the following package:

```java
package DateTimeAttributeTest {
    public import ScalarValues::*;
    public import Time::*;

    // --- BAD: string literal passed directly to Iso8601DateTime constructor.
    // Produces: ScalarValues::String does not conform to Time::Iso8601DateTimeEncoding
    attribute badBirth : Iso8601DateTime = new Iso8601DateTime("1926-04-03T00:00:00Z");

    // --- CANDIDATE A: wrap the string in an Iso8601DateTimeEncoding constructor,
    // then pass positionally to Iso8601DateTime.
    attribute candidateA : Iso8601DateTime = new Iso8601DateTime(
        new Iso8601DateTimeEncoding("1926-04-03T00:00:00Z")
    );

    // --- CANDIDATE B: redefine `val` inline using :>>.
    attribute candidateB : Iso8601DateTime {
        :>> val = new Iso8601DateTimeEncoding("1926-04-03T00:00:00Z");
    }

    // --- CANDIDATE C: bare string in :>> binding also fails.
    // Iso8601DateTimeEncoding :> String means Iso8601DateTimeEncoding is a subtype of String,
    // so a String literal is not assignable to Iso8601DateTimeEncoding regardless of binding context.
    attribute candidateC : Iso8601DateTime {
        :>> val = "1926-04-03T00:00:00Z";
    }
}

```

Regards,

Adam Layne, PhD

---

<div class="post-metadata">

**Author:** ![Robert\_Karban](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/robert_karban/32/119_2.png) [@Robert\_Karban](https://forum.sensmetry.com/u/Robert_Karban)\
**Post date:** [April 1, 2026, 12:52am UTC](https://forum.sensmetry.com/t/whats-the-right-format-for-creating-a-iso8601datetime-attribute/432/3 "2026-04-01T00:52:28Z")

</div>

> [@Adam\_Layne](#):
>
> ```auto
> // --- CANDIDATE A: wrap the string in an Iso8601DateTimeEncoding constructor,
> // then pass positionally to Iso8601DateTime.
> attribute candidateA : Iso8601DateTime = new Iso8601DateTime(
> new Iso8601DateTimeEncoding("1926-04-03T00:00:00Z")
> );
> 
> // --- CANDIDATE B: redefine `val` inline using :>>.
> attribute candidateB : Iso8601DateTime {
> :>> val = new Iso8601DateTimeEncoding("1926-04-03T00:00:00Z");
> }
> 
> // --- CANDIDATE C: bare string in :>> binding also fails.
> // Iso8601DateTimeEncoding :> String means Iso8601DateTimeEncoding is a subtype of String,
> // so a String literal is not assignable to Iso8601DateTimeEncoding regardless of binding context.
> attribute candidateC : Iso8601DateTime {
> :>> val = "1926-04-03T00:00:00Z";
> }
> 
> ```

Great @Adam_Layne , Thanks!  
Candidate B works

---

<div class="post-metadata">

**Author:** ![Adam\_Layne](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/adam_layne/32/230_2.png) [@Adam\_Layne](https://forum.sensmetry.com/u/Adam_Layne)\
**Post date:** [April 1, 2026, 12:58am UTC](https://forum.sensmetry.com/t/whats-the-right-format-for-creating-a-iso8601datetime-attribute/432/4 "2026-04-01T00:58:04Z")

</div>

Robert,

Happy to help. By the way, you can interpret this warning like a type error in a programming language.

```plaintext
ScalarValues::String does not conform to Time::Iso8601DateTimeEncoding

```

means something like

```plaintext
Couldn't match type ‘ScalarValues::String’ with ‘Time::Iso8601DateTimeEncoding’
      Expected: Time::Iso8601DateTimeEncoding
        Actual: ScalarValues::String

```

Adam
