當前位置: 首頁>>代碼示例>>C#>>正文


C# PersianCalendar.GetMinute方法代碼示例

本文整理匯總了C#中System.Globalization.PersianCalendar.GetMinute方法的典型用法代碼示例。如果您正苦於以下問題:C# PersianCalendar.GetMinute方法的具體用法?C# PersianCalendar.GetMinute怎麽用?C# PersianCalendar.GetMinute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Globalization.PersianCalendar的用法示例。


在下文中一共展示了PersianCalendar.GetMinute方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ConvertToIranTimeString

        public string ConvertToIranTimeString(DateTime Date)
        {
            //string zoneId = "Iran Standard Time";
            //TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
            //DateTime result = TimeZoneInfo.ConvertTimeFromUtc(Date, tzi);

            Date = Date.AddMinutes(-150);

            PersianCalendar pc = new PersianCalendar();
            string year = pc.GetYear(Date).ToString();
            string Month = pc.GetMonth(Date).ToString();
            string Day = pc.GetDayOfMonth(Date).ToString();
            string Hour = pc.GetHour(Date).ToString();
            string Minute = pc.GetMinute(Date).ToString();

            if (Month.Length == 1)
            {
                Month = "0" + Month;
            }
            if (Day.Length == 1)
            {
                Day = "0" + Day;
            }
            if (Hour.Length == 1)
            {
                Hour = "0" + Hour;
            }
            if (Minute.Length == 1)
            {
                Minute = "0" + Minute;
            }

            return year + "/" + Month + "/" + Day + " " + Hour + ":" + Minute;
        }
開發者ID:farhad85,項目名稱:Iranegan,代碼行數:34,代碼來源:Time.cs

示例2: setTime

 public string setTime()
 {
     PersianCalendar pdate = new PersianCalendar();
     DateTime nT = new DateTime();
     nT = DateTime.Now;
     string time = "";
     time = pdate.GetHour(nT) + ":" + pdate.GetMinute(nT);
     return time;
 }
開發者ID:saeedehsaneei,項目名稱:educationDegree,代碼行數:9,代碼來源:Main.Master.cs

示例3: ConvertToPersianDatetime

        public static DateTime ConvertToPersianDatetime(DateTime datetime)
        {
            var per = new PersianCalendar();

            var year = per.GetYear(datetime);
            var month = per.GetMonth(datetime);
            var day = per.GetDayOfMonth(datetime);
            var hour = per.GetHour(datetime);
            var minute = per.GetMinute(datetime);

            return new DateTime(year, month, day, hour, minute, 0);
        }
開發者ID:Chitva,項目名稱:Ganjine,代碼行數:12,代碼來源:CommonMethods.cs

示例4: getNewNameForMp4

 private string getNewNameForMp4(string path)
 {
     try
     {
         FileInfo fi = new FileInfo(path);
         MediaInfo mi = new MediaInfo();
         mi.Open(path);
         string[] dataLines = mi.Inform().Split('\n');
         foreach (string line in dataLines)
         {
             if (line.StartsWith("Encoded date"))
             {
                 // parse `encoded date` tag:
                 // >Encoded date                             : UTC 2014-07-29 15:21:29
                 string newLine = line.Substring(line.IndexOf(':') + 1);    // > UTC 2014-07-29 15:21:29
                 newLine = newLine.Replace("UTC", "");                       // >  2014-07-29 15:21:29
                 newLine = newLine.Trim();                                   // >2014-07-29 15:21:29
                 //newLine = newLine.Replace(':', '-');                      // >2014-07-29 15-21-29
                 DateTime dt = DateTime.Parse(newLine);
                 PersianCalendar pc = new PersianCalendar();
                 StringBuilder result = new StringBuilder();
                 result.Append(pc.GetYear(dt));
                 result.Append('_');
                 result.Append(pc.GetMonth(dt));
                 return String.Format(
                     "{0}_{1,2:D2}_{2,2:D2} - {3:D2}_{4:D2}_{5:D2}{6}",
                     pc.GetYear(dt),
                     pc.GetMonth(dt),
                     pc.GetDayOfMonth(dt),
                     pc.GetHour(dt),
                     pc.GetMinute(dt),
                     pc.GetSecond(dt),
                     fi.Extension
                 );
             }
         }
         return "";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return "";
     }
 }
開發者ID:alimzadeh,項目名稱:FixCameraFileName,代碼行數:44,代碼來源:FrmMain.cs

示例5: getNewNameForJpg

        private string getNewNameForJpg(string path)
        {
            try
            {
                FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
                Image myImage = Image.FromStream(fs, false, false);
                PropertyItem propItem = myImage.GetPropertyItem(36867);
                string dateTaken = Encoding.UTF8.GetString(propItem.Value);
                fs.Close();
                string[] dateTakenParts = dateTaken.Split(' ');
                dateTakenParts[0] = dateTakenParts[0].Replace(':', '-');
                DateTime dt = DateTime.Parse(dateTakenParts[0] + " " + dateTakenParts[1]);

                PersianCalendar pc = new PersianCalendar();
                StringBuilder result = new StringBuilder();
                result.Append(pc.GetYear(dt));
                result.Append('_');
                result.Append(pc.GetMonth(dt));
                return String.Format(
                    "{0}_{1,2:D2}_{2,2:D2} - {3:D2}_{4:D2}_{5:D2}{6}",
                    pc.GetYear(dt),
                    pc.GetMonth(dt),
                    pc.GetDayOfMonth(dt),
                    pc.GetHour(dt),
                    pc.GetMinute(dt),
                    pc.GetSecond(dt),
                    new FileInfo(path).Extension
                );
            }
            catch
            {
                return "";
            }
        }
開發者ID:alimzadeh,項目名稱:FixCameraFileName,代碼行數:34,代碼來源:FrmMain.cs

示例6: Parse

        public static PersianDateTime Parse(DateTime dateTime)
        {
            var cal = new PersianCalendar();
            var result = new PersianDateTime
            {
                Year = cal.GetYear(dateTime),
                Month = cal.GetMonth(dateTime),
                Day = cal.GetDayOfMonth(dateTime),
                Hour = cal.GetHour(dateTime),
                Minute = cal.GetMinute(dateTime),
                Second = cal.GetSecond(dateTime)
            };

            return result;
        }
開發者ID:hamidhaghighatkhah,項目名稱:WebApi-Routes,代碼行數:15,代碼來源:DateHelper.cs

示例7: PersianDateTime

 public PersianDateTime()
 {
     var dateTime = DateTime.Now;
     var calendar = new PersianCalendar();
     Year = calendar.GetYear(dateTime);
     Month = calendar.GetMonth(dateTime);
     Day = calendar.GetDayOfMonth(dateTime);
     Hour = calendar.GetHour(dateTime);
     Minute = calendar.GetMinute(dateTime);
     Second = calendar.GetSecond(dateTime);
 }
開發者ID:hamidhaghighatkhah,項目名稱:WebApi-Routes,代碼行數:11,代碼來源:DateHelper.cs


注:本文中的System.Globalization.PersianCalendar.GetMinute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。