/// <summary> /// �����ڶ���ת��Ϊ��ʽ�ַ��� /// </summary> /// <param name="oDateTime">���ڶ���</param> /// <param name="strFormat"> /// ��ʽ�� /// "SHORTDATE"===������ /// "LONGDATE"==������ /// ����====�Զ����ʽ /// </param> /// <returns>�����ַ���</returns> public static string ConvertDateToString(DateTime oDateTime, string strFormat) { string strDate = ""; try { switch (strFormat.ToUpper()) { case "SHORTDATE": strDate = oDateTime.ToShortDateString(); break; case "LONGDATE": strDate = oDateTime.ToLongDateString(); break; default: strDate = oDateTime.ToString(strFormat); break; } } catch (Exception) { strDate = oDateTime.ToShortDateString(); } return strDate; }
private static Boolean checkDateTime(DateTime time) { Boolean result = false; String path = ApplicationData.Current.LocalFolder.Path + "/time.txt"; if (File.Exists(path)) { TextReader reader = new StreamReader(path); String date = reader.ReadLine(); reader.Close(); DateTime timeFile = DateTime.Parse(date); int compared = timeFile.CompareTo(time); if (compared > 0) { TextWriter tw = new StreamWriter(path); tw.WriteLine(time.ToLongDateString() + " " + time.ToLongTimeString()); tw.Close(); result = true; } } else { TextWriter tw = new StreamWriter(path); tw.WriteLine(time.ToLongDateString() + " " + time.ToLongTimeString()); tw.Close(); } return result; }
public void setToDayOfYear(int aDayOfYear) { initLabels(); DateTime theDate = new DateTime( 2015, 12, 28 ).AddDays( aDayOfYear ); title.text = theDate.ToLongDateString().Substring(0,theDate.ToLongDateString().Length-5); if(aDayOfYear==ChampionshipSeason.ACTIVE_SEASON.secondsPast) { TweenColor.Begin(this.gameObject,0.25f,this.tint); //this.GetComponent<UISprite>().color = this.tint; } else { TweenColor.Begin(this.gameObject,0.25f,this.original); //this.GetComponent<UISprite>().color = ; } GTTeam myTeam = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam(); TrackDatabaseRecord tdr = ChampionshipSeason.ACTIVE_SEASON.seasonForTeam(myTeam).eventOnDay(aDayOfYear); UITexture t= this.GetComponentInChildren<UITexture>(); if(tdr!=null) { Texture texture1 = (Texture) Resources.Load ("Race/Thumbnails/"+tdr.imagePrefabName); if(t!=null) t.mainTexture = texture1; } else { if(t!=null) t.mainTexture = null; tdr = ChampionshipSeason.ACTIVE_SEASON.seasonForTeam(myTeam).eventOnDay(aDayOfYear+7); if(tdr!=null) { title.text += "\n(One week till next race)"; } RandomEvent specialEvent = ChampionshipSeason.ACTIVE_SEASON.seasonForTeam(myTeam).getRandomEventOnDay(aDayOfYear); if(specialEvent!=null) { Texture texture1 = (Texture) Resources.Load ("gambleicon"); if(t!=null) { t.mainTexture = texture1; } } } if(myTeam.hasResearchCompletingOnDay(aDayOfYear)) { GTCar car1 = myTeam.cars[0]; GTCar car2 = myTeam.cars[1]; GTDriver driver1 = myTeam.drivers[0]; GTDriver driver2 = myTeam.drivers[1]; string research = ""; if(car1.hasResearchCompletingOnDay(aDayOfYear)!=null) { GTEquippedResearch researchBit = car1.hasResearchCompletingOnDay(aDayOfYear); research = researchBit.researchRow._partname+" Completion for "+driver1.name+"\n"; } if(car2.hasResearchCompletingOnDay(aDayOfYear)!=null) { GTEquippedResearch researchBit = car2.hasResearchCompletingOnDay(aDayOfYear); research += researchBit.researchRow._partname+" Completion for "+driver2.name; } this.researchText.text = research; } else { this.researchText.text = ""; } }
public void FillMeMonth(DateTime date) { try { this.paymentsDS.Payments.Clear(); this.paymentsTableAdapter.Connection.ConnectionString = myForms.myConnectionString; this.paymentsTableAdapter.FillByMonth(this.paymentsDS.Payments,date.ToLongDateString(),date.ToLongDateString()); this.paymentsBindingSource.DataMember = "Payments"; this.paymentsBindingSource.ResetBindings(false); } catch (Exception ex) { myForms.MsgBox(ex.Message); } }
static void Main(string[] args) { DateTime dt = new DateTime(1901, 1, 1); int sundays = 0; do { if (dt.DayOfWeek == DayOfWeek.Sunday && dt.Day == 1) { sundays += 1; Console.Write("+ "); Console.WriteLine(dt.ToLongDateString()); } else { //Console.WriteLine(dt.ToLongDateString()); } dt = dt.AddDays(1); } while (dt.Year != 2001); Console.WriteLine(sundays); }
public void DisplayText(NetworkEvent ne) { this.m_Image = null; DateTime time = new DateTime(ne.timeIndex); this.infoLabel.Text = ""; this.appendText("Sender: " + ne.source); this.appendText("Time: " + time.ToLongDateString() + " " + time.ToLongTimeString()); if (ne is NetworkChunkEvent) { NetworkChunkEvent nce = ne as NetworkChunkEvent; this.appendText("Category: Chunk"); this.appendText("Message Sequence: " + nce.chunk.MessageSequence); this.appendText("Chunk Sequence: " + nce.chunk.ChunkSequence); this.appendText("First Chunk Sequence of Message: " + nce.chunk.FirstChunkSequenceOfMessage); this.appendText("Number of Chunks: " + nce.chunk.NumberOfChunksInMessage); } else if (ne is NetworkMessageEvent) { NetworkMessageEvent nme = ne as NetworkMessageEvent; this.appendText("Category: Message"); this.displayMessageEventRecursive(nme.message); } else if (ne is NetworkNACKMessageEvent) { } else { //Unknown this.infoLabel.Text = "Unknown Type"; } this.doubleBufferPanel.Invalidate(); }
public string getEaster(int year) { int offset; int leap; int day; int temp1; int temp2; int total; offset = year % 19; leap = year % 4; day = year % 7; temp1 = (19 * offset + 24) % 30; temp2 = (2 * leap + 4 + day + 6 * temp1 + 5) % 7; total = (22 + temp1 + temp2); if (total > 31) { month = 4; day = total - 31; } else { month = 3; day = total; } DateTime myDT = new DateTime(year, month, day); return myDT.ToLongDateString(); }
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); }
public NRVFile(string ERName, string Door, string CardType, DateTime StartTime, string NVRFile, string VideoRecord) { InitializeComponent(); txt_ERName.Text = ERName; txt_Door.Text = Door; txt_StartTime.Text = StartTime.ToLongDateString() + " " + StartTime.ToLongTimeString(); txt_EventName.Text = CardType; nvrFile = NVRFile; string showNVRFile= "/VideoRecord/" + nvrFile.Trim(); //media.Source = new Uri("http://192.192.85.64/secure/ClientBin" + showNVRFile,UriKind.Absolute); media.Source = new Uri(VideoRecord + showNVRFile, UriKind.Absolute); double totalSeconds = media.Position.TotalSeconds; // 获取当前位置秒数 double nowTotalSeconds = media.NaturalDuration.TimeSpan.TotalSeconds; //获取文件总播放秒数 nowTime.Text = totalSeconds.ToString(); totalTime.Text = (Math.Round(nowTotalSeconds, 0)).ToString(); //WebClient wc = new WebClient(); //wc.OpenReadCompleted +=(s,a)=> // { // media.SetSource(a.Result as Stream); // }; //wc.OpenReadAsync(new Uri("http://192.192.85.64/secure/ClientBin" + showNVRFile,UriKind.Absolute)); }
public int InsertSensorData( int sensorMetadataId, int intermediateHwMetadataId, string measuredData, DateTime measuredAt, DateTime polledAt, int sensorType) { // using (SqlConnection connection = new SqlConnection(connectionStringb.ConnectionString)) using (SqlConnection connection = new SqlConnection(this.connectionString)) { string queryString = string.Format( "INSERT INTO SensorData (SensorMetadataId, IntermediateHwMedadataId, MeasuredData, MeasuredAt, SendAt, PolledAt, UpdatedAt, CreatedAt, SensorType) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');", sensorMetadataId, intermediateHwMetadataId, measuredData, measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(), measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(), polledAt.ToLongDateString() + " " + polledAt.ToLongTimeString(), measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(), measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(), sensorType); SqlCommand command = new SqlCommand(queryString, connection); return ExecuteSQLCommand(command); } }
public string extenso() { CultureInfo culture = new CultureInfo("pt-BR"); DateTime myDateTime = new System.DateTime(this.ano, this.mes, this.dia); return(myDateTime.ToLongDateString()); }
private void selectsign_Load(object sender, EventArgs e) { setDate(); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; String strYMD = currentTime.ToLongDateString(); comboBox1.Text = strYMD; allpeople.Text = getPersonCount().ToString(); zc.Text = getCount(comboBox1.Text, "True").ToString(); cd.Text = getCount(comboBox1.Text, "False").ToString(); wqd.Text = (getPersonCount() - getCount(comboBox1.Text, "True") - getCount(comboBox1.Text, "False")).ToString(); cmdT = "select eid as 员工号,stime as 签到时间,sflag as 签到状态 from sign where sdate='" + comboBox1.Text + "'"; DataTable dt = DBhelper.GetTable(cmdT); int count = dt.Rows.Count; if (count % pagesize == 0) { pagecount = count / pagesize; } else { pagecount = count / pagesize + 1; } allpage.Text = pagecount.ToString(); index = 1; SetDGV(); }
public static void Main() { string msg1 = "The date and time patterns are defined in the DateTimeFormatInfo \n" + "object associated with the current thread culture.\n"; // Initialize a DateTime object. Console.WriteLine("Initialize the DateTime object to May 16, 2001 3:02:15 AM.\n"); DateTime myDateTime = new System.DateTime(2001, 5, 16, 3, 2, 15); // Identify the source of the date and time patterns. Console.WriteLine(msg1); // Display the name of the current culture. CultureInfo ci = Thread.CurrentThread.CurrentCulture; Console.WriteLine("Current culture: \"{0}\"\n", ci.Name); // Display the long date pattern and string. Console.WriteLine("Long date pattern: \"{0}\"", ci.DateTimeFormat.LongDatePattern); Console.WriteLine("Long date string: \"{0}\"\n", myDateTime.ToLongDateString()); // Display the long time pattern and string. Console.WriteLine("Long time pattern: \"{0}\"", ci.DateTimeFormat.LongTimePattern); Console.WriteLine("Long time string: \"{0}\"\n", myDateTime.ToLongTimeString()); // Display the short date pattern and string. Console.WriteLine("Short date pattern: \"{0}\"", ci.DateTimeFormat.ShortDatePattern); Console.WriteLine("Short date string: \"{0}\"\n", myDateTime.ToShortDateString()); // Display the short time pattern and string. Console.WriteLine("Short time pattern: \"{0}\"", ci.DateTimeFormat.ShortTimePattern); Console.WriteLine("Short time string: \"{0}\"\n", myDateTime.ToShortTimeString()); }
private void ComboBoxSelectDateTime_DropDown( object sender, EventArgs eventArgs ) { this.axDatePickerSelectDataTime.Left = this.ComboBoxSelectDateTime.Left; this.axDatePickerSelectDataTime.Top = this.ComboBoxSelectDateTime.Top + ComboBoxSelectDateTime.Height + 1; this.axDatePickerSelectDataTime.EnsureVisible( DateTime.Now - TimeSpan.FromDays( 90.0 ) ); if ( this.axDatePickerSelectDataTime.ShowModal( 2, 2 ) == true ) { int nCount = this.axDatePickerSelectDataTime.Selection.BlocksCount; if ( nCount > 0 ) { if ( this.axDatePickerSelectDataTime.Selection[nCount - 1].DateEnd > DateTime.Now ) m_DateEnd = DateTime.Now; else m_DateEnd = this.axDatePickerSelectDataTime.Selection[nCount - 1].DateEnd; if ( this.axDatePickerSelectDataTime.Selection[0].DateBegin > ( m_DateEnd - TimeSpan.FromDays( 3.0 ) ) ) m_DateBegin = m_DateEnd - TimeSpan.FromDays( 2.0 ); else m_DateBegin = this.axDatePickerSelectDataTime.Selection[0].DateBegin; m_DateSelection = m_DateEnd; this.ComboBoxSelectDateTime.Text = m_DateSelection.ToLongDateString(); this.NumericUpDownKLine.Value = ( m_DateEnd - m_DateBegin ).Days + 1; } } KLineU50ConfigB.PostMessage( this.ComboBoxSelectDateTime.Handle.ToInt32(), CB_SHOWDROPDOWN, 0, 0 ); }
// ָ��Ϊǰһ�����ֵ���룬x%��� public override ICollection<StockOper> GetOper(DateTime day, IAccount account) { IStockData prevStockProp = stockHistory.GetPrevDayStock(day); if (prevStockProp == null) { Debug.WriteLine("StrategyPercent -- GetPrevDayStock ERROR: Cur Day: " + day.ToLongDateString()); return null; } ICollection<StockOper> opers = new List<StockOper>(); int stockCount = Transaction.GetCanBuyStockCount(account.BankRoll, prevStockProp.MinPrice); if (stockCount > 0) { StockOper oper = new StockOper(prevStockProp.MinPrice, stockCount, OperType.Buy); opers.Add(oper); } if (stockHolder.HasStock()) { double unitCost = stockHolder.UnitPrice; if (unitCost > 0) { StockOper oper2 = new StockOper(unitCost * (1 + winPercent), stockHolder.StockCount(), OperType.Sell); opers.Add(oper2); } } return opers; }
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; //} }
public string extenso(int ano, int mes, int dia) { CultureInfo culture = new CultureInfo("pt-BR"); DateTime myDateTime = new System.DateTime(ano, mes, dia); return(myDateTime.ToLongDateString()); }
public string GetDateString(System.DateTime date) { if (string.IsNullOrEmpty(Format) == false) { return(date.ToString(Format)); } if (stringType == DateTimeStringType.ToString) { return(date.ToString()); } else if (stringType == DateTimeStringType.ToLongDateString) { return(date.ToLongDateString()); } else if (stringType == DateTimeStringType.ToLongTimeString) { return(date.ToLongTimeString()); } else if (stringType == DateTimeStringType.ToShortDateString) { return(date.ToShortDateString()); } else if (stringType == DateTimeStringType.ToShortTimeString) { return(date.ToShortTimeString()); } return(date.ToString()); }
public IHtmlNode CellTag(DateTime currentDay, DateTime? selectedDate, string urlFormat, bool isOtherMonth) { IHtmlNode cell = new HtmlElement("td"); if (isOtherMonth) { cell.AddClass("t-other-month"); } else if (selectedDate.HasValue && IsInRange(selectedDate.Value) && currentDay.Day == selectedDate.Value.Day) { cell.AddClass(UIPrimitives.SelectedState); } if (IsInRange(currentDay)) { var href = GetUrl(currentDay, urlFormat); IHtmlNode link = new HtmlElement("a") .AddClass(UIPrimitives.Link + (href != "#" ? " t-action-link" : string.Empty)) .Attribute("href", href) .Attribute("title", currentDay.ToLongDateString()) .Text(currentDay.Day.ToString()); cell.Children.Add(link); } else { cell.Html(" "); } return cell; }
private void Form1_Load(object sender, EventArgs e) { LeXML L = new LeXML(File); label1.Text = O.Retorna_Pos_Ult_Prodt().ToString(); Tempo_Atual = DateTime.Now; DataHora.Text = Tempo_Atual.ToLongDateString()+" - " + Tempo_Atual.ToLongTimeString(); }
public static String[,] EnumerateComputersAndLastLogonTimeStamp() { List<SearchResult> computerList = new List<SearchResult>(EnumerateComputers()); // List<DateTime> lastLogonTimeStampList = new List<DateTime>(); String[,] computerAndTimeStamp = new String[computerList.Count, computerList.Count]; ResultPropertyCollection myResultPropColl; int i = 0; foreach (SearchResult computer in computerList) { long lastLogonTimeStamp; DateTime dateTime = new DateTime(); myResultPropColl = computer.Properties; if (computer.Properties.Contains("lastlogontimestamp")) { lastLogonTimeStamp = (long)(myResultPropColl["lastlogontimestamp"][0]); dateTime = DateTime.FromFileTime(lastLogonTimeStamp); //lastLogonTimeStampList.Add(dateTime); computerAndTimeStamp[i, 0] = computer.GetDirectoryEntry().Name.Substring(3).ToUpper(); computerAndTimeStamp[i, 1] = dateTime.ToLongDateString(); } else { computerAndTimeStamp[i, 0] = computer.GetDirectoryEntry().Name.Substring(3).ToUpper(); computerAndTimeStamp[i, 1] = "No timestamp"; } i++; } return computerAndTimeStamp; /* foreach (string myKey in myResultPropColl.PropertyNames) { properties += myKey + " = "; foreach (Object myCollection in myResultPropColl[myKey]) { properties += myCollection + "\n"; } } * MessageBox.Show(properties);*/ //System.DateTime dateTime = new System.DateTime(1601, 1, 1, 0, 0, 0, 0); // System.DateTime dateTime2 = System.DateTime.FromFileTime(Convert.ToInt64(myResultPropColl["lastlogontimestamp"].ToString())); // Add the number of seconds in UNIX timestamp to be converted. // ulong timestamp = Convert.(); //dateTime = dateTime.AddMilliseconds(timestamp); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. //string printDate = dateTime2.ToShortDateString() +" "+ dateTime2.ToShortTimeString(); // MessageBox.Show(dateTime2.ToString()); }
// ����㷨��ָ��Ϊǰһ�����ֵ���룬���ֵ��� public override ICollection<StockOper> GetOper(DateTime day, IAccount account) { IStockData prevStock = stockHistory.GetPrevDayStock(day); if (prevStock == null) { Debug.WriteLine("StrategyMinMax -- GetPrevDayStock ERROR: Cur Day: " + day.ToLongDateString()); //Debug.Assert(false); return null; } ICollection<StockOper> opers = new List<StockOper>(); int stockCount = Transaction.GetCanBuyStockCount(account.BankRoll, prevStock.MinPrice); if (stockCount > 0) { StockOper oper = new StockOper(prevStock.MinPrice, stockCount, OperType.Buy); opers.Add(oper); } if (stockHolder.HasStock()) { StockOper oper2 = new StockOper(prevStock.MaxPrice, stockHolder.StockCount(), OperType.Sell); opers.Add(oper2); } return opers; }
public static void Main() { // Initialize a DateTime object. Console.WriteLine("Initialize the DateTime object to May 16, 2001 3:02:15 AM.\n"); DateTime dateAndTime = new System.DateTime(2001, 5, 16, 3, 2, 15); // Display the name of the current culture. Console.WriteLine($"Current culture: \"{CultureInfo.CurrentCulture.Name}\"\n"); var dtfi = CultureInfo.CurrentCulture.DateTimeFormat; // Display the long date pattern and string. Console.WriteLine($"Long date pattern: \"{dtfi.LongDatePattern}\""); Console.WriteLine($"Long date string: \"{dateAndTime.ToLongDateString()}\"\n"); // Display the long time pattern and string. Console.WriteLine($"Long time pattern: \"{dtfi.LongTimePattern}\""); Console.WriteLine($"Long time string: \"{dateAndTime.ToLongTimeString()}\"\n"); // Display the short date pattern and string. Console.WriteLine($"Short date pattern: \"{dtfi.ShortDatePattern}\""); Console.WriteLine($"Short date string: \"{dateAndTime.ToShortDateString()}\"\n"); // Display the short time pattern and string. Console.WriteLine($"Short time pattern: \"{dtfi.ShortTimePattern}\""); Console.WriteLine($"Short time string: \"{dateAndTime.ToShortTimeString()}\"\n"); }
public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // Note: monthOfYear is a value between 0 and 11, not 1 and 12! DateTime selectedDate = new DateTime(year, monthOfYear + 1, dayOfMonth); Log.Debug(TAG, selectedDate.ToLongDateString()); _dateSelectedHandler(selectedDate); }
public void LoadClientsTable() { string connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); int orgId = Convert.ToInt32(Session["CURRENT_ORG_ID"]); List<int> clientsIds = new List<int>(); dataBlock.OpenConnection(); int orgTypeId = dataBlock.organizationTable.GetOrgTypeId(orgId); clientsIds = dataBlock.organizationTable.Get_AllOrganizationsId(orgId); Session["ClientsTab_UserControl_ClientsIds"] = clientsIds; DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("CLIENTNAME", typeof(string))); dt.Columns.Add(new DataColumn("REG_DATE", typeof(string))); dt.Columns.Add(new DataColumn("ENDREG_DATE", typeof(string))); dt.Columns.Add(new DataColumn("COUNTRY", typeof(string))); dt.Columns.Add(new DataColumn("CITY", typeof(string))); int clientInfoId = 0; DateTime date = new DateTime(); int userId = 1; foreach (int id in clientsIds) { userId = 0; dr = dt.NewRow(); dr["CLIENTNAME"] = dataBlock.organizationTable.GetOrganizationName(id); //REG_DATE if (DateTime.TryParse(dataBlock.organizationTable.GetAdditionalOrgInfo(id, DataBaseReference.OrgInfo_RegistrationDate), out date)) dr["REG_DATE"] = date.ToLongDateString() + " " + date.ToShortTimeString(); //END_REG_DATE if (DateTime.TryParse(dataBlock.organizationTable.GetAdditionalOrgInfo(id, DataBaseReference.OrgInfo_EndOfRegistrationDate), out date)) dr["ENDREG_DATE"] = date.ToLongDateString(); //COUNTRY dr["COUNTRY"] = dataBlock.organizationTable.GetOrgCountryName(id); //CITY dr["CITY"] = dataBlock.organizationTable.GetAdditionalOrgInfo(id, DataBaseReference.OrgInfo_City); // dt.Rows.Add(dr); } ClientsDataGrid.DataSource = dt; ClientsDataGrid.DataBind(); dataBlock.CloseConnection(); }
private void timer1_Tick(object sender, EventArgs e) { System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; // labelX2.Text = currentTime.ToString(); //"f" ); //不显示秒 labelX2.Text = currentTime.ToLongDateString(); labelX2.Text = labelX2.Text + " " + DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("zh-cn")) + " " + currentTime.ToString("T"); //中文星期显示 }
public void ClearForm(DateTime oDate) { m_Date = oDate; this.Text = m_Date.ToLongDateString(); this.m_txtboxSubj.Text = ""; this.m_rchboxMsg.Text = ""; this.m_cmbboxRecur.SelectedIndex = 0; this.m_cmbboxLeadTime.SelectedIndex = 0; }
public void PopulateForm(DateTime oDate, Message oMessage) { m_Date = oDate; this.Text = m_Date.ToLongDateString(); this.m_txtboxSubj.Text = oMessage.Subject; this.m_rchboxMsg.Text = oMessage.Body; this.m_cmbboxRecur.SelectedIndex = (int)oMessage.RecurFrequency; this.m_cmbboxLeadTime.SelectedIndex = oMessage.LeadTime; }
public void OnExpRecordButtonDown() { SystemGlobal sg = SystemGlobal.Instance; System.DateTime Time = System.DateTime.Now; sg.m_OpRecord.Add("\t" + Time.ToLongDateString() + "/" + Time.ToLongTimeString() + "\t 进入实验记录界面"); UnityEngine.SceneManagement.SceneManager.LoadScene("ExpRecord"); }
protected void ThenACorresponsingRowInDatabaseShouldContainEndDate(DateTime endDate) { using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionName].ConnectionString)) { connection.Open(); var sql = "SELECT * FROM [AuctionSettings] WHERE Id = @Id"; Assert.Single(SqlMapper.Query<AuctionSettings>(connection, sql, new { Id = this.ReturnedAuctionIdentity.Id }), a => a.EndDate.ToLongDateString() == endDate.ToLongDateString()); } }
private void Record(int score) { SystemGlobal sg = SystemGlobal.Instance; System.DateTime Time = System.DateTime.Now; sg.m_SubmitDateTime = Time; sg.m_OpRecord.Add("\t" + Time.ToLongDateString() + "/" + Time.ToLongTimeString() + "\t 提交数据" + "数据得分:" + score); PlugFastenGlobal pg = PlugFastenGlobal.Instance; System.TimeSpan span = new System.TimeSpan(); span = sg.m_SubmitDateTime - sg.m_StartDateTime; sg.m_OpRecord.Add("\t" + Time.ToLongDateString() + "/" + Time.ToLongTimeString() + "\t 提交数据" + "用时:" + span.TotalMinutes + "分钟"); if (pg.m_PlugCorrect) { } }
public void OnDateChanged(DatePicker view, int year, int month, int day) { mDate = new DateTime(year, month +1, day, mDate.Hour, mDate.Minute, 0); // .NET uses 1 based months, Android uses 0 based months Arguments.PutInt(EXTRA_YEAR, mDate.Year); Arguments.PutInt(EXTRA_MONTH, mDate.Month); Arguments.PutInt(EXTRA_DAY, mDate.Day); Console.WriteLine("Date Changed: {0}", mDate.ToLongDateString()); }
// Use this for initialization void Start() { string filename = "ModLoaderConfirmed.txt"; using (System.IO.StreamWriter file = new System.IO.StreamWriter(filename, true)) { System.DateTime date = System.DateTime.Now; file.WriteLine(date.ToLongDateString() + ", " + date.ToLongTimeString() + " ~ " + filename); } }
public void OnReturnButtonDown() { SystemGlobal sg = SystemGlobal.Instance; System.DateTime Time = System.DateTime.Now; sg.m_OpRecord.Add("\t" + Time.ToLongDateString() + "/" + Time.ToLongTimeString() + "\t 进入初始界面"); UnityEngine.SceneManagement.SceneManager.LoadScene("SelectExpType"); }
public ItemReportForm(Int64 fromOID, Int64 toOID, DateTime fromDate, DateTime toDate, int orderCount, bool showAll, string _dateRangeText) { InitializeComponent(); // fiscalPrinter = new FiscalPrinter(); tempPrintMethods = new CPrintMethodsEXT(); this.fromDate = fromDate; this.toDate = toDate; dateRangeText = _dateRangeText; _showAll = showAll; lblDate.Text += " " + fromDate.ToLongDateString() + " to: " + toDate.ToLongDateString(); lblOrderCount.Text += orderCount; SystemManager sysManager = new SystemManager(); dtFood = sysManager.GetItemWiseSales(fromOID, toOID, "Food", Convert.ToByte(showAll)); gridViewFood.DataSource = dtFood; dtNonFood = sysManager.GetItemWiseSales(fromOID, toOID, "NonFood", Convert.ToByte(showAll)); gridViewNonFood.DataSource = dtNonFood; if (dtFood != null && dtNonFood != null) { int query = (from order in dtFood.AsEnumerable() select order.Field<Int32>("QuantitySold")).Sum(); lblQtySoldFood.Text += " " + query; int query2 = (from order in dtNonFood.AsEnumerable() select order.Field<Int32>("QuantitySold")).Sum(); lblQtySoldNonFood.Text += " " + query2; lblQtySoldTotal.Text += " " + (query2 + query); Double P1 = 0; Double P2 = 0; foreach (DataRow row in dtFood.Rows) { P1 += Convert.ToDouble(row["TotalPrice"].ToString()); } foreach (DataRow row in dtNonFood.Rows) { P2 += Convert.ToDouble(row["TotalPrice"].ToString()); } lblPriceFood.Text += " " + P1.ToString("F02"); lblPriceNonFood.Text += " " + P2.ToString("F02"); lblPriceTotal.Text += " " + (P1 + P2).ToString("F02"); } }
internal uc_shedule_profesional_timeline() { InitializeComponent(); if (DesignMode) return; lblProfesional.Text = string.Empty; CurrentDateTime = DateTime.Now; lblFechaSeleccionada.Text = CurrentDateTime.ToLongDateString(); uc_ShiftsControls1.SetContextMenuVisible(true, true, false, true, true); }
private string BuildMailBody(DateTime day, Artist artist, List<Performance> performances) { if (performances.Count == 0) { return ""; } string bodyTemplate = File.ReadAllText(Config.Get().MailBodyTemplatePath); string itemTemplate = File.ReadAllText(Config.Get().MailBodyItemTemplatePath); return bodyTemplate.Replace(ARTIST_KEY, artist.Name) .Replace(DATE_KEY, day.ToLongDateString()) .Replace(ITEMS_KEY, BuildMailBodyItems(itemTemplate, performances)); }
public static void Main(string[] args) { DateTime dt = new DateTime(); System.Console.WriteLine(dt.ToLongDateString()); System.Console.WriteLine(dt.ToShortDateString()); System.Console.WriteLine(dt.ToShortTimeString()); System.Console.WriteLine(dt.ToLocalTime().ToString()); System.Console.WriteLine(string.Format("yyyy-MM-dd",dt)); System.Console.WriteLine(dt.ToString("yyyy-MM-dd")); System.Console.ReadLine(); }
public void SetTotalValue(DateTime dt, double val) { if (val <= 0) { LogMgr.Logger.LogInfo("StockValues: SetTotalValue error at: " + dt.ToLongDateString()); } else { _DateValues.Add(dt, val); } }
private void FrmHistoryTransaction_Load(object sender, System.EventArgs e) { DataTable dt = new DataTable(); HistoryTransactionTableAdapter local_history = new HistoryTransactionTableAdapter(); SqlCeConnection connection = new SqlCeConnection(local_history.Connection.ConnectionString); connection.Open(); SqlCeDataAdapter adapter = new SqlCeDataAdapter(string.Format(@"Select Body, DateTime, PIC from HistoryTransaction where AccountName = '{0}' and ServerID = '{1}' and GroupName = '{2}' and IsGroup = '{3}' ORDER BY DateTime ASC", _xmppClient.Username, _xmppClient.XmppDomain, _roomJid.Bare, (_isGroup ? "1" : "0")), connection); adapter.Fill(dt); connection.Close(); DateTime dtTemp = new DateTime(); foreach (DataRow item in dt.Rows) { DateTime dTime = DateTime.Parse(item["DateTime"].ToString()); string decrypt = item["PIC"].ToString() + " said: " + Cryptography.RSA2.Decrypt(item["Body"].ToString()); if (dt.Rows.IndexOf(item) == 0) { dtTemp = dTime; txtBox.SelectionColor = Color.Black; txtBox.SelectionAlignment = HorizontalAlignment.Center; txtBox.SelectionFont = new System.Drawing.Font(txtBox.Font, FontStyle.Bold); txtBox.AppendText(dtTemp.ToLongDateString().ToString()); txtBox.AppendText("\r\n"); } else if (dtTemp.Date.CompareTo(dTime.Date) != 0) { dtTemp = dTime; txtBox.SelectionColor = Color.Black; txtBox.SelectionAlignment = HorizontalAlignment.Center; txtBox.SelectionFont = new System.Drawing.Font(txtBox.Font, FontStyle.Bold); txtBox.AppendText(dtTemp.ToLongDateString().ToString()); txtBox.AppendText("\r\n"); } txtBox.SelectionAlignment = HorizontalAlignment.Left; txtBox.SelectionFont = new System.Drawing.Font(txtBox.Font, FontStyle.Regular); txtBox.AppendText("(" + DateTime.Parse(item["DateTime"].ToString()).TimeOfDay.ToString() + ") " + decrypt); txtBox.AppendText("\r\n"); } }
public static long ConvertDateTimeToJavaMS(DateTime date) { Console.WriteLine ("### Converting date: " + date.ToLongDateString () + " time: " + date.ToLongTimeString ()); DateTime UTCBaseTime = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Local); //Console.WriteLine ("### Converting date, UTCBaseTime: " + UTCBaseTime.ToString ()); TimeSpan ts = date - UTCBaseTime; long ms = (long)ts.TotalMilliseconds; //account for time zone - 2 hours from GMT long twoHours = 1000 * 60 * 60 * 2; return ms - twoHours; }
public string GetTimeStamp() { string s = ""; System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; s += currentTime.ToLongDateString(); s += currentTime.Hour; s += "时"; s += currentTime.Minute; s += "分"; s += currentTime.Second; s += "秒"; return(s); }
private void selectad_Load(object sender, EventArgs e) { setDate(); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; String strYMD = currentTime.ToLongDateString(); comboBox1.Text = strYMD; count.Text = getDateCountAD(comboBox1.Text).ToString(); String cmdText = "select * from ad where date='" + comboBox1.Text + "' "; dataGridView1.DataSource = DBhelper.GetTable(cmdText); this.dataGridView1.Columns[0].FillWeight = 20; this.dataGridView1.Columns[1].FillWeight = 170; }
private void signinfo_Load(object sender, EventArgs e) { System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; strYMD = currentTime.ToLongDateString(); strT = currentTime.ToString("t"); strH = currentTime.Hour; int day = getDate(); if (day == 1) { //说明已经签到了 btn.Text = "已签到"; btn.Enabled = false; MessageBox.Show("今天已经签到过了,明天再来!!"); } }
protected override void SolveInstance(IGH_DataAccess DA) { List <string> log = new List <string>(); bool loggedIn = Default.LoggedIn; System.DateTime lastLogin = Default.LastLoggedIn; log.Add("Axis Version Number: " + Assembly.GetExecutingAssembly().GetName().Version); // Check the validity of the login token. (Refactored method) DateTime t0 = DateTime.Now; Auth auth = new Auth(); bool isValid = auth.IsValid; if (isValid) { log.Add("Valid token."); } log.Add(DateTime.Now.Subtract(t0).TotalMilliseconds.ToString()); if (Default.LoggedIn) { log.Add("Logged in."); log.Add("LLI: " + lastLogin.ToLongDateString() + ", " + lastLogin.ToShortTimeString()); DateTime validTo = lastLogin.AddDays(2); int valid = DateTime.Compare(System.DateTime.Now, validTo); if (valid < 0) { log.Add("Login token valid."); log.Add("Valid to: " + validTo.ToLongDateString() + ", " + validTo.ToShortTimeString()); } Default.ValidTo = validTo; } if (loggedIn) { this.Message = "Logged In"; } else { this.Message = "Error"; } DA.SetDataList(0, log); }
static StackObject *ToLongDateString_19(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.DateTime instance_of_this_method = (System.DateTime) typeof(System.DateTime).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 16); var result_of_this_method = instance_of_this_method.ToLongDateString(); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
private void deletead_Load(object sender, EventArgs e) { setDate(); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; String strYMD = currentTime.ToLongDateString(); comboBox1.Text = strYMD; sda = DBhelper.GetSDA("select * from ad where date='" + comboBox1.Text + "' "); SqlCommandBuilder acb = new SqlCommandBuilder(sda); DataSet ds = new DataSet(); sda.Fill(ds, "st"); dt = ds.Tables["st"]; dataGridView1.DataSource = dt; this.dataGridView1.Columns[0].FillWeight = 20; this.dataGridView1.Columns[1].FillWeight = 170; }
private void date_Time_thread() { while (true) { try { date_time.Invoke((Action) delegate { System.DateTime date = System.DateTime.Now; date_time.Text = "" + date.ToLongDateString() + " : " + date.ToLongTimeString(); date_time.Refresh(); }); } catch (Exception ex) { // MessageBox.Show(""+ex); } } }
private void addbtn_Click(object sender, EventArgs e) { System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; String strYMD = currentTime.ToLongDateString(); String cmdText = "insert into ad(cont,date) values(@con,@date)"; SqlParameter consprm = new SqlParameter("@con", richTextBox1.Text.Trim()); SqlParameter datesprm = new SqlParameter("@date", strYMD); SqlParameter[] sprm = new SqlParameter[] { consprm, datesprm }; int count = DBhelper.Add(cmdText, sprm); if (count > 0) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败"); } }
public string ConvertDigitTimeToChnTime(System.DateTime resTime) { string text = resTime.ToLongDateString(); int num = text.IndexOf('年'); int num2 = text.IndexOf('月'); int num3 = text.IndexOf('日'); string strYearIntegral = text.Substring(0, num); string strIntegral = text.Substring(num + 1, num2 - num - 1); string strIntegral2 = text.Substring(num2 + 1, num3 - num2 - 1); string text2 = this.ConvertYearIntegral(strYearIntegral); string text3 = this.ConvertIntegral(strIntegral, false); string text4 = this.ConvertIntegral(strIntegral2, false); return(string.Concat(new string[] { text2, "年", text3, "月", text4, "日" })); }
private void GetDate() { if (dateTimeKind == DateTimeKind.Utc) { mDate = System.DateTime.UtcNow; } else { mDate = System.DateTime.Now; } mMonth = mDate.Month.ToString(DateTimeFormatInfo.InvariantInfo); mDay = mDate.Day.ToString(DateTimeFormatInfo.InvariantInfo); mYear = mDate.Year.ToString(DateTimeFormatInfo.InvariantInfo); mHour = mDate.Hour.ToString(DateTimeFormatInfo.InvariantInfo); mMinute = mDate.Minute.ToString(DateTimeFormatInfo.InvariantInfo); mSecond = mDate.Second.ToString(DateTimeFormatInfo.InvariantInfo); mMillisecond = mDate.Millisecond.ToString(DateTimeFormatInfo.InvariantInfo); mTicks = mDate.Ticks.ToString(DateTimeFormatInfo.InvariantInfo); mKind = mDate.Kind.ToString(); mTimeOfDay = mDate.TimeOfDay.ToString(); mDayOfYear = mDate.DayOfYear.ToString(DateTimeFormatInfo.InvariantInfo); mDayOfWeek = mDate.DayOfWeek.ToString(); mShortDate = mDate.ToShortDateString(); mLongDate = mDate.ToLongDateString(); mShortTime = mDate.ToShortTimeString(); mLongTime = mDate.ToLongTimeString(); if (format == null) { mFormattedTime = mDate.ToString(DateTimeFormatInfo.InvariantInfo); } else { mFormattedTime = mDate.ToString(format, DateTimeFormatInfo.InvariantInfo); } }
public static string ShowTime(System.DateTime dateTime) { return(dateTime.ToLongDateString()); }
public static string FormatDateTimeLong(System.DateTime Expression) { //return String.Format(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern, Expression); return(Expression.ToLongDateString() + " " + Expression.ToLongTimeString()); }
public static void WriteLogToFile(string msg) { string strDic = System.AppDomain.CurrentDomain.BaseDirectory; System.DateTime currentTime = System.DateTime.Now; if (!Directory.Exists(strDic + "\\logFiles\\" + DateTime.Now.ToString("yyyy-MM-dd"))) { Directory.CreateDirectory(strDic + "\\logFiles\\" + DateTime.Now.ToString("yyyy-MM-dd")); } string logPath = strDic + "\\logFiles\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\IMPORT_DTJC_LOG_" + currentTime.ToLongDateString() + ".txt"; try { using (StreamWriter sw = File.AppendText(logPath)) { sw.WriteLine("[" + currentTime.ToString() + "]" + msg); sw.Flush(); sw.Close(); sw.Dispose(); } } catch (IOException e) { using (StreamWriter sw = File.AppendText(logPath)) { sw.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]" + e.Message); sw.Flush(); sw.Close(); sw.Dispose(); } } }
/// <summary> /// Creates a string representing a long version of the time /// </summary> /// <returns>The long version of the time</returns> private string nowLong() { System.DateTime dtNow = System.DateTime.Now.ToUniversalTime(); return(dtNow.ToLongDateString() + " - " + dtNow.ToShortTimeString() + " UTC "); }