\dateTime methods behavior does not make sense to me

6 views
Skip to first unread message

Marc Petit-Huguenin

unread,
Jan 9, 2026, 10:30:49 AM (12 days ago) Jan 9
to ErgoAI and XSB Users Forum
Hi,

Please help me understand what I got wrong below (my timezone is -08:00).

\dateTime[now->?x]@\btp, \dateTime[now(utc)->?y]@\btp, \dateTime[now(1)->?z]@\btp
?x = "2026-01-09T07:00:17Z"^^\dateTime
?y = "2026-01-09T15:00:17Z"^^\dateTime
?z = "2026-01-09T15:00:17+01:00"^^\dateTime

?x seems incorrect, it is the correct localtime, but expressed as UTC.  It should be \dt"2026-01-09T07:00:17".

?y seems correct.

?z seems incorrect, it should be \dt"2026-01-09T16:00:17+01:00".

\dt"2026-01-09T16:00:17+01:00"[localtime -> ?x]@\btp.
?x = "2026-01-09T17:00:17"^^\dateTime

?x seems incorrect, should have been \dt"2026-01-09T16:00:17", i,e, the same date time, but as localtime in that time zone.

\dt"2026-01-09T16:00:17+01:00"[toTZ(-8,0) -> ?x]@\btp.
?x = "2026-01-09T16:00:17-08:00"^^\dateTime

?x should have been \dt"2026-01-09T07:00:17-08:00", i.e. the same date time but as seen from the provided timezone.

For completeness:

\dt"2026-01-09T07:00:17"[toUTC(-8, 0) -> ?x]@\btp
?x = "2026-01-09T15:00:17-08:00"^^\dateTime

This seems correct, the localtime in converted into a date time in the specified time zone.

Please advise.
Reply all
Reply to author
Forward
0 new messages