@@ -38,6 +38,8 @@ public static class CryptoUtility
3838 internal static readonly DateTime UnixEpochLocal = new DateTime ( 1970 , 1 , 1 , 0 , 0 , 0 , 0 , DateTimeKind . Local ) ;
3939 internal static readonly Encoding Utf8EncodingNoPrefix = new UTF8Encoding ( false , true ) ;
4040 static bool isWindows = System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ;
41+ static string chinaZoneId = isWindows ? "China Standard Time" : "Asia/Shanghai" ;
42+ static TimeZoneInfo chinaZone = TimeZoneInfo . FindSystemTimeZoneById ( chinaZoneId ) ;
4143 static string koreanZoneId = isWindows ? "Korea Standard Time" : "Asia/Seoul" ;
4244 static TimeZoneInfo koreaZone = TimeZoneInfo . FindSystemTimeZoneById ( koreanZoneId ) ;
4345
@@ -188,7 +190,7 @@ public enum SourceTimeZone
188190 {
189191 /// <summary> time zone is specifically specified in string </summary>
190192 AsSpecified ,
191- Local , Korea , UTC
193+ Local , China , Korea , UTC ,
192194 }
193195 /// <summary>
194196 /// Convert object to a UTC DateTime
@@ -215,6 +217,8 @@ public static DateTime ToDateTimeInvariant(this object obj, SourceTimeZone sourc
215217 throw new NotImplementedException ( ) ; // TODO: implement this when needed
216218 case SourceTimeZone . Local :
217219 return DateTime . SpecifyKind ( dt , DateTimeKind . Local ) . ToUniversalTime ( ) ; // convert to UTC
220+ case SourceTimeZone . China :
221+ return TimeZoneInfo . ConvertTime ( dt , chinaZone , TimeZoneInfo . Utc ) ; // convert to UTC
218222 case SourceTimeZone . Korea :
219223 return TimeZoneInfo . ConvertTime ( dt , koreaZone , TimeZoneInfo . Utc ) ; // convert to UTC
220224 case SourceTimeZone . UTC :
@@ -693,6 +697,9 @@ public static DateTime ParseTimestamp(object value, TimestampType type)
693697 case TimestampType . Iso8601Local :
694698 return value . ToDateTimeInvariant ( SourceTimeZone . Local ) ;
695699
700+ case TimestampType . Iso8601China :
701+ return value . ToDateTimeInvariant ( SourceTimeZone . China ) ;
702+
696703 case TimestampType . Iso8601Korea :
697704 return value . ToDateTimeInvariant ( SourceTimeZone . Korea ) ;
698705
@@ -1481,6 +1488,11 @@ public enum TimestampType
14811488 /// </summary>
14821489 Iso8601Local ,
14831490
1491+ /// <summary>
1492+ /// ISO 8601 in china Standard Time
1493+ /// </summary>
1494+ Iso8601China ,
1495+
14841496 /// <summary>
14851497 /// ISO 8601 in Korea Standard Time
14861498 /// </summary>
0 commit comments