From a3d72ed4e233598d018795e9a48ad7e9fbe5af51 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 18 Jul 2025 04:25:45 +0330 Subject: [PATCH] last ... --- Extensions/CommonExtensions.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Extensions/CommonExtensions.cs b/Extensions/CommonExtensions.cs index 89a5f64..f8c7aea 100644 --- a/Extensions/CommonExtensions.cs +++ b/Extensions/CommonExtensions.cs @@ -1179,6 +1179,13 @@ namespace xCommons.Extensions var result = DateTimeOffset.FromUnixTimeMilliseconds(timestamp); return result.DateTime; } + public static DateTime FromTimestamp(this string source) + { + // + var timestamp = Int64.Parse(source); + var time = timestamp.FromTimestamp(); + return time; + } /// /// Check a Date Time is Expired or not @@ -1188,7 +1195,7 @@ namespace xCommons.Extensions public static bool IsExPired(this DateTime source) { // - if (source == null) + if (source.IsNull()) { return true; } @@ -1202,7 +1209,14 @@ namespace xCommons.Extensions } public static bool IsExpired(this long source) { - return source.FromTimestamp().IsExPired(); + var time = source.FromTimestamp(); + return time.IsExPired(); + } + public static bool IsExpired(this string source) + { + // + var time = DateTime.Parse(source); + return time.IsExPired(); } ///