本文整理汇总了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);
}
}
示例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;
//}
}
示例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);
}
示例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());
}
示例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");
}
示例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);
}
示例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");
}
}
示例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();
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
示例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;
}
}
示例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;
}