当前位置: 首页>>代码示例>>C#>>正文


C# DateTime.ToShortTimeString方法代码示例

本文整理汇总了C#中System.DateTime.ToShortTimeString方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.ToShortTimeString方法的具体用法?C# DateTime.ToShortTimeString怎么用?C# DateTime.ToShortTimeString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.DateTime的用法示例。


在下文中一共展示了DateTime.ToShortTimeString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Event_Rep

        public Event_Rep(
            int eventID,
            DateTime startTime,
            DateTime endTime,
            string keyframePath,
            string comment,
            bool loadImage)
        {
            this.eventID = eventID;
            this.startTime = startTime;
            this.endTime = endTime;
            this.eventDuration = endTime - startTime;
            this.comment = comment;
            this.shortComment = GetStringStart(comment, 15);
            this.keyframePath = keyframePath;
            this.borderColour = DefaultKeyframeBorderColour;

            //format time string for UI
            if (startTime.Hour < 12)
            {
                this.strTime = startTime.ToShortTimeString() + " am";
            }
            else
            {
                this.strTime = startTime.ToShortTimeString() + " pm";
            }
            this.eventLength = Daily_Annotation_Summary.SecondsToString(
                (int)eventDuration.TotalSeconds);

            if (loadImage) {
                this.keyframeSource = Image_Rep.GetImgBitmap(keyframePath, false);
            }
        }
开发者ID:activityMonitoring,项目名称:wearable-camera-desktop-browser,代码行数:33,代码来源:Event_Rep.cs

示例2: setOutlookFields

        public void setOutlookFields(DateTime startDate, DateTime endDate, string room, DateTime startTime, DateTime endTime)
        {
            //Set To: field
            DateTime dateTimeStart;
            //String a = " 04:00 A.M";

            String test = startDate.ToLongDateString();
            String test2 = startDate.ToShortTimeString();
            String test4 = startDate.ToLongTimeString();
            String test3 = startDate.ToShortTimeString();

            dateTimeStart = DateTime.Parse(startDate.Month.ToString() + "/" + startDate.Day.ToString() + "/" + startDate.Year.ToString()  +" "+ startTime.Hour +":" + startTime.Minute +":" + startTime.Second+"." + startTime.Millisecond);

            DateTime dateTimeEnd;
            dateTimeEnd = DateTime.Parse(endDate.Month.ToString() + "/" + endDate.Day.ToString() + "/" + endDate.Year.ToString() + " " + endTime.Hour + ":" + endTime.Minute + ":" + endTime.Second + "." + endTime.Millisecond);

            //if (dateTimeStart > dateTimeEnd)
            //{

            //}
            //else
            //{
                (Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem).StartInStartTimeZone = dateTimeStart;
                (Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem).EndInEndTimeZone = dateTimeEnd;
                (Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem).Location = room;
            //}
        }
开发者ID:chiakh,项目名称:SmartRoomBookingSystem,代码行数:27,代码来源:ThisAddIn.cs

示例3: EvidencijaTreningaIzvestaj

        public EvidencijaTreningaIzvestaj(Nullable<int> clanId, DateTime from, DateTime to, List<Grupa> grupe)
        {
            this.clanId = clanId;
            Title = "Dolazak na trening";
            string subtitle;
            if (from.Date == to.Date)
            {
                subtitle = from.ToLongDateString();
                subtitle += "   " + from.ToShortTimeString() + " - " + to.ToShortTimeString();
            }
            else
            {
                subtitle = from.ToShortDateString() + " " + from.ToShortTimeString();
                subtitle += " - " + to.ToShortDateString() + " " + to.ToShortTimeString();
            }
            SubTitle = subtitle;
            DocumentName = Title;

            clanFont = new Font("Arial", 10, FontStyle.Bold);
            itemFont = new Font("Courier New", 9);
            Font itemsHeaderFont = null;
            Font groupTitleFont = new Font("Courier New", 10, FontStyle.Bold);
            lista = new EvidencijaTreningaLista(clanId, from, to, grupe, this, 1, 0f,
                itemFont, itemsHeaderFont, groupTitleFont);
        }
开发者ID:stankela,项目名称:clanovi,代码行数:25,代码来源:EvidencijaTreningaIzvestaj.cs

示例4: LogItemDate

        public static HtmlString LogItemDate(DateTime p_Date)
        {
            if (p_Date >= DateTime.Today)
            {
                return new HtmlString(p_Date.ToShortTimeString());
            }

            if (p_Date >= DateTime.Today.AddDays(-1))
            {
                return new HtmlString("Yesterday, " + p_Date.ToShortTimeString());
            }

            if (p_Date >= DateTime.Today.AddDays(-7))
            {
                return new HtmlString(p_Date.ToString("dddd") + ", " + p_Date.ToShortTimeString());
            }

            if (p_Date >= DateTime.Today.AddYears(-1))
            {
                return new HtmlString(p_Date.ToString("dd MMM") + ", " + p_Date.ToShortTimeString());
            }

            if (p_Date == DateTime.MinValue)
            {
                return new HtmlString("");
            }

            return new HtmlString(p_Date.ToString("dd MMM yy") + ", " + p_Date.ToShortTimeString());
        }
开发者ID:px-lewis-wilkie,项目名称:PxLogWebService,代码行数:29,代码来源:LogItem.cs

示例5: PrintFormats

		public void PrintFormats(DateTime dateTime)
		{
			Log("dateTime.ToShortDateString(): " + dateTime.ToShortDateString());
			Log("dateTime.ToShortTimeString(): " + dateTime.ToShortTimeString());
			Log("dateTime.ToLongTimeString(): " + dateTime.ToLongTimeString());
			Log("dateTime.ToShortTimeString(): " + dateTime.ToShortTimeString());
			Log("dateTime.ToString(): " + dateTime.ToString());
			Log("DateTimeSerializer.ToShortestXsdDateTimeString(dateTime): " + DateTimeSerializer.ToShortestXsdDateTimeString(dateTime));
			Log("DateTimeSerializer.ToDateTimeString(dateTime): " + DateTimeSerializer.ToDateTimeString(dateTime));
			Log("DateTimeSerializer.ToXsdDateTimeString(dateTime): " + DateTimeSerializer.ToXsdDateTimeString(dateTime));
			Log("\n");
		}
开发者ID:rickardn,项目名称:ServiceStack.Text,代码行数:12,代码来源:DateTimeSerializerTests.cs

示例6: agregarHorario

        //public void agregarHorario(int dia,DateTime desde,DateTime hasta)
        public void agregarHorario(int idHorario,int fila,DateTime horaDesde,DateTime horaHasta)
        {
            horarios.Add(idHorario,new HorarioAuxiliar(idHorario, horaDesde, horaHasta));
            TimeSpan diferencia = horaHasta - horaDesde;
            float diferenciaHoras = (float)diferencia.Hours + ((float)diferencia.Minutes / (float)60);
            float diferenciaInicioYHoradesde = (float)horaDesde.Hour + ((float)horaDesde.Minute / (float)60) - this.horaDesde;
            Control pan = tlpHorariosDias.GetControlFromPosition(0, fila);
            Button button = new Button();
            button.BackColor = Color.DarkOrchid;;
            button.Name = idHorario.ToString();
            float anchoHorarios = pan.Width;
            float diferenciaHorasComponente = this.horaHasta - this.horaDesde;
            float anchoHora = pan.Width / diferenciaHorasComponente;
            button.Height = (int)(pan.Height);
            button.Width = (int)(diferenciaHoras * anchoHora);
            button.Top = 0;
            button.Left = (int)(diferenciaInicioYHoradesde * anchoHora + this.desplazamiento);
            button.MouseHover += new EventHandler(mostrarHora);
            button.MouseLeave += new EventHandler(limpiarLabel);

            System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(button, horaDesde.ToShortTimeString() + " hasta " + horaHasta.ToShortTimeString());

            pan.Controls.Add(button);
        }
开发者ID:waltergorozco,项目名称:proyecto5k2,代码行数:26,代码来源:GHorario.cs

示例7: Main

    static void Main()
    {
        DateTime timeBeer = new DateTime();
        Console.Write("Enter time: ");
        bool isValid = DateTime.TryParse(Console.ReadLine(), out timeBeer);
        if (isValid)
        {
            Console.WriteLine("Is it beer time?");
            Console.WriteLine(timeBeer.ToShortTimeString());
            TimeSpan daytime = timeBeer.TimeOfDay;
            TimeSpan endBeertime = new TimeSpan(3, 00, 00);
            TimeSpan startBeertime = new TimeSpan(13, 00, 00);

            if ((daytime < endBeertime) || (daytime >= startBeertime))
            {
                Console.WriteLine("IT IS BEER TIMEEEEEEEEEEEE!");
            }
            else
            {
                Console.WriteLine("NON-BEER TIME");
            }
        }
        else
        {
            Console.WriteLine("Invalid time");
        }
    }
开发者ID:plami,项目名称:SoftUninHomeworks,代码行数:27,代码来源:BeerTime.cs

示例8: SetEntry

 /// <summary>
 /// Sets up the entry for the schedule
 /// </summary>
 /// <param name="previousTaskEnd">The time where the task before this ended</param>
 /// <param name="duration"></param>
 /// <param name="taskDescription"></param>
 public void SetEntry(DateTime previousTaskEnd, TimeSpan duration, string taskDescription)
 {
     previousEnd = previousTaskEnd;
     Duration = duration;
     description.Content = taskDescription;
     time.Content = previousTaskEnd.ToShortTimeString();
 }
开发者ID:wallnutkraken,项目名称:project-marmelade,代码行数:13,代码来源:ScheduleEntry.xaml.cs

示例9: Trace

        public Trace(string traceName, DateTime created, int number)
        {
            Name = traceName; gen = created; pts = number;
            LineTwo = created.ToShortDateString() + " " + created.ToShortTimeString() + " | " + number + " pts";

            _name = Name; _lineTwo = LineTwo;
        }
开发者ID:Ren-Chang,项目名称:WP7_OSMTracker,代码行数:7,代码来源:Trace.cs

示例10: button2_Click

        //otomatik bağlan işe yaramaması yada bir den çok com port bulunma durumunakarşı hazırlanan kısım
        //com bortu ve baud rate yi manuel girerek saat bilgisini arduino ya gönderir
        private void button2_Click(object sender, EventArgs e)
        {
            if (serialPort1.IsOpen) serialPort1.Close();
            serialPort1.PortName = Interaction.InputBox("COM PORT GİRİNİZ: ");
            int baudRate;
            if (System.Int32.TryParse(Interaction.InputBox("BAUD RATE GİRİNİZ: "), out baudRate))
            {
                serialPort1.BaudRate = baudRate;

                try
                {
                    serialPort1.Open();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Geçerli Baud Rate Giriniz!", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (serialPort1.IsOpen)
            {
                zaman = DateTime.Now;
                serialPort1.Write(zaman.ToShortTimeString() + zaman.Second.ToString() + "|");
                serialPort1.Close();
            }
        }
开发者ID:oguzhanbaser,项目名称:C-Sharp,代码行数:32,代码来源:7segment.cs

示例11: AddParam

        public Query AddParam(string name, DateTime value)
        {
            m_command.Parameters.Add(name, SqlDbType.DateTime);
            m_command.Parameters[name].Value = value.ToShortDateString() + " " + value.ToShortTimeString();

            return this;
        }
开发者ID:anxkha,项目名称:DRM,代码行数:7,代码来源:Query.cs

示例12: VoiceMailEntry

        public VoiceMailEntry(WebVoiceMailControl owner, InfoFile info)
        {
            mOwner = owner;
            InitializeComponent();
            Dock = DockStyle.Top;
            this.progressBar.EndWaiting();
            this.progressBar.Enabled = false;
            this.progressBar.Visible = false;

            mFileInfo = info;
            lFrom.Text = mFileInfo.From;
            DateTime dateTime = new DateTime(1970, 1, 1);
            dateTime = dateTime.AddSeconds(mFileInfo.Time);
            lDate.Text = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString();
            tbTagIt.Text = mFileInfo.Tags;
            //Setup Color Scheme

            mCached = mFileInfo.Cached;
            if (mCached)
            {
                mFileInfo.FileName = Path.GetFileName(mFileInfo.FileName);               
            }

            this.Name = mFileInfo.FileName;
            this.toolTip.SetToolTip(this.lFrom, mFileInfo.From);
            this.toolTip.SetToolTip(this.pMailImage, mFileInfo.Location.ToString());
            ResetButtonDesign();
        }
开发者ID:biddyweb,项目名称:communicator,代码行数:28,代码来源:VoiceMailEntry.cs

示例13: AddUser

        public void AddUser(string jsonString)
        {
            using (var session = FluentNHibernateConfiguration.InitFactory.sessionFactory.OpenSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    JObject jsonObject = JObject.Parse(jsonString);
                    var user = new Entities.Member
                    {
                        memberFirstName = jsonObject.SelectToken("firstName").ToString(),
                        memberLastName = jsonObject.SelectToken("lastName").ToString(),
                        userName = jsonObject.SelectToken("userName").ToString(),
                        memberPassword = jsonObject.SelectToken("password").ToString(),
                        memberEmail = jsonObject.SelectToken("email").ToString()
                    };

                    JavaScriptSerializer js = new JavaScriptSerializer();
                    DateTime dt = new DateTime();
                    user.memberHash = util.UtilityMethods.CalculateMD5Hash(user.userName + dt.ToShortTimeString());
                    Context.Response.Write(js.Serialize(new Response3 { LogIn = 1, twocubeSSO = user.memberHash }));
                    session.Save(user);
                    transaction.Commit();

                }
            }
        }
开发者ID:cheokjiade,项目名称:twocube---CZ2006-Software-Engineering,代码行数:26,代码来源:MemberControllerService.asmx.cs

示例14: Repaint

        public virtual void Repaint(InventoryNoticeMessage message)
        {
            this.showTime = (int)message.duration;
            this.dateTime = message.time;

            if (string.IsNullOrEmpty(message.title) == false)
            {
                if (this.title != null)
                {
                    this.title.text = string.Format(message.title, message.parameters);
                    this.title.color = message.color;
                }
            }
            else
                title.gameObject.SetActive(false);


            this.message.text = string.Format(message.message, message.parameters);
            this.message.color = message.color;

            if (this.time != null)
            {
                this.time.text = dateTime.ToShortTimeString();
                this.time.color = message.color;
            }
        }
开发者ID:predominant,项目名称:Treasure_Chest,代码行数:26,代码来源:NoticeMessageUI.cs

示例15: AddNewRow

        void AddNewRow(int position, System.Data.DataRow row)
        {
            ListViewItem lvi = new ListViewItem();
            lvi.Name = (position + 1).ToString();
            lvi.Text = (position + 1).ToString();
            int vid = 0;
            if (!System.Convert.IsDBNull(row["VendorID"])) vid = (int)row["VendorID"];
            string vendor = "";
            if (!System.Convert.IsDBNull(row["VendorName"])) vendor = (string)row["VendorName"];
            string vtype = "";
            if (!System.Convert.IsDBNull(row["VendorType"])) vtype = ((int)row["VendorType"]).ToString();
            //            byte[] logo = null;
            //            if (!System.Convert.IsDBNull(row["Logo"])) logo = (byte[])row["Logo"];
            DateTime cr_dtm = new DateTime(1900, 1, 1);
            if (!System.Convert.IsDBNull(row["Created"])) cr_dtm = ((DateTime)row["Created"]);
            lvi.SubItems.Add(vid.ToString());
            lvi.SubItems.Add(vendor);
            lvi.SubItems.Add(vtype);
            //            lvi.SubItems.Add(logo);
            lvi.SubItems.Add("");
            lvi.SubItems.Add(cr_dtm.ToShortDateString() + " " + cr_dtm.ToShortTimeString());

            this.lvVendors.Items.Add(lvi);
            return;
        }
开发者ID:Skydger,项目名称:vBudget,代码行数:25,代码来源:VendorsListForm.cs


注:本文中的System.DateTime.ToShortTimeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。