commit b71c42164e330b7c6f56f737b002db91eef9900f
parent 57b90d374aa139600d76ddb34fedc8847b9e26d3
Author: Byron Torres <b@torresjrjr.com>
Date: Thu, 3 Feb 2022 21:07:05 +0000
new datetime::from_instant()
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/datetime/datetime.ha b/datetime/datetime.ha
@@ -193,6 +193,11 @@ export fn from_moment(m: chrono::moment) datetime = {
return dt;
};
+// Creates a [[datetime]] from a [[time::instant]]
+export fn from_instant(i: time::instant, loc: chrono::locality) datetime = {
+ return from_moment(chrono::from_instant(i, loc));
+};
+
// Creates a [[datetime]] from a string, parsed according to a layout,
// using [[strategy::ALL]], or fails otherwise.
//