convert UTC to GMT format:
/// <summary> ///conversion of UTC format to Datatime/// </summary> /// <param name= "UTC" ></param> /// <returns></returns> PublicDateTime Convertintdatetime (DoubleUTC) {System.DateTime StartTime= TimeZone.CurrentTimeZone.ToLocalTime (NewSystem.DateTime (1970,1,1)); StartTime=Starttime.addseconds (UTC); StartTime= Starttime.addhours (8);//Convert to Beijing time (Beijing time =UTC time + 8 hours) returnStartTime; }
hexadecimal conversion to decimal:
/// <summary> ///hexadecimal conversion to decimal/// </summary> /// <param name= "Strcolorvalue" ></param> /// <returns></returns> Public intGethexadecimalvalue (String strcolorvalue) {Char[] Nums =Strcolorvalue.tochararray (); intTotal =0; Try { for(inti =0; I < Nums. Length; i++) {String strnum=Nums[i]. ToString (). ToUpper (); Switch(strnum) { Case "A": Strnum="Ten"; Break; Case "B": Strnum=" One"; Break; Case "C": Strnum=" A"; Break; Case "D": Strnum=" -"; Break; Case "E": Strnum=" -"; Break; Case "F": Strnum=" the"; Break; default: Break; } DoublePower = Math.pow ( -, Convert.todouble (nums. Length-i-1)); Total+ = Convert.ToInt32 (strnum) *Convert.ToInt32 (Power); } } Catch(System.Exception ex) {String Strerorr=Ex. ToString (); return 0; } returnTotal ; }
UTC format Conversion & hexadecimal conversion to decimal