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 ScoreStop() { System.DateTime now = System.DateTime.Now; PlayerPrefs.SetString("key", now.ToLongTimeString()); PlayerPrefs.SetInt("PLAY_COUNT", playCount); PlayerPrefs.SetInt("SCORE" + playCount, MyScore); PlayerPrefs.SetString("TimeData" + playCount, now.ToLongTimeString()); }
//检查履历 private void insLog(string str) { string currPath = System.Windows.Forms.Application.StartupPath; string logPath = currPath + "/logHougai/"; if (!Directory.Exists(logPath)) { System.IO.Directory.CreateDirectory(logPath); } //按年月存放文件夹 System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; string folderName = logPath + currentTime.Year.ToString("D4") + currentTime.Month.ToString("D2"); if (!Directory.Exists(folderName)) { System.IO.Directory.CreateDirectory(folderName); } string fileName = folderName + "/" + currentTime.Day.ToString() + ".csv"; //文件头 string strHead = "Time,"; for (int i = 0; i < spectable.Rows.Count; i++) { strHead += spectable.Rows[i][0]; strHead += ","; } if (!File.Exists(fileName)) { using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { StreamWriter sw = new StreamWriter(fs); sw.WriteLine(strHead); sw.WriteLine(currentTime.ToLongTimeString().ToString() + "," + str); sw.Flush(); } } //文件内容 else { using (FileStream fs = new FileStream(fileName, FileMode.Append, FileAccess.Write)) { StreamWriter sw = new StreamWriter(fs); sw.WriteLine(currentTime.ToLongTimeString().ToString() + "," + str); sw.Flush(); } } }
protected void Button2_Click(object sender, EventArgs e) { clockOutDateTime = DateTime.Now; Label2.Text = "Time ended: " + clockOutDateTime.ToLongTimeString(); SubmitButton.Visible = true; ClockOutButton.Visible = false; }
protected void Button1_Click(object sender, EventArgs e) { clockInDateTime = DateTime.Now; Label1.Text = "Time started: " + clockInDateTime.ToLongTimeString(); ClockOutButton.Visible = true; ClockInButton.Visible = false; }
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 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 BtStopwatchOptionsClick(object sender, EventArgs e) { switch (btStopwatchOptions.Text) { case "Скинути": tabCircle.Controls.Clear(); btControlStopwatch.Text = "Старт"; btStopwatchOptions.Visible = false; btStopwatchOptions.Text = "Новий круг"; dtStopwatch = new DateTime(2010, 2, 10, 0, 0, 0, 0); lbStopwatchResult.Text = String.Format("{0}:{1}", dtStopwatch.ToLongTimeString(), dtStopwatch.Millisecond / 100); for (int i = 0; i < tabPageList.dtList.Count; i++) { tabPageList.dtList[i] = new DateTime(2010, 2, 10, 0, 0, 0, 0); } break; case "Новий круг": tabCircle.Controls.Add(tabPageList[tabPageList.Index]); tabPageList[tabPageList.Index].UseVisualStyleBackColor = true; tabCircle.SelectTab(tabPageList.Index) ; tabPageList.Index++; if (tabPageList.Index ==9) { btStopwatchOptions.Enabled = false; } break; default: MessageBox.Show("Error"); break; } }
public void AddListViewItem(bool recieve, MQTTPacketTypes packetType, int? packetId, string topic, string data, DateTime time) { if (testing) return; // type id topic data time ListViewItem newItem = new ListViewItem(new[] { (packetId != null ? ((int) packetId).ToString() : ""), GetPacketTypeString(packetType), topic, data, time.ToShortDateString() + " " + time.ToLongTimeString() }) {BackColor = recieve ? Color.FromArgb(148, 255, 114, 114) : Color.FromArgb(148, 61, 218, 61)}; _listViewItems.Add(newItem); if (packetType == MQTTPacketTypes.PINGRESP) UpdateLastPingTimeLabel(@"Last successful ping at ",time); if (autoScrollCheckBox.Checked) newItem.EnsureVisible(); if (_showPings // if it is a ping and we are allowed to show it just let it through || (packetType != MQTTPacketTypes.PINGREQ && packetType != MQTTPacketTypes.PINGRESP)) // or if it isn't a ping { outputListView.Invoke((MethodInvoker) delegate { AddListViewItem(newItem); }); } }
public string EncryptTime(DateTime time) { string timeString = time.ToLongTimeString(); string encryptString = Crypto.Encrypt(timeString); return encryptString; }
protected void Page_Load(object sender, EventArgs e) { System.DateTime start = System.DateTime.Now; // Thread.Sleep(5000); Trace.Write("Deneme--1"); Trace.Warn("Deneme--2"); if (!Page.IsPostBack) { Trace.Write("In the postback method, before the GetFeaturedProducts request"); DataView dw = new DataView(((DataLayer)Application["DataLayer"]).GetFeaturedProducts()); dlFeatured.DataSource = dw; Trace.Write("Before databinding"); dlFeatured.DataBind(); Trace.Write("After databinding"); } System.DateTime end = System.DateTime.Now; lblStartTime.Text = start.ToLongTimeString(); string time = end.Subtract(start).Seconds + "." + end.Subtract(start).Milliseconds; lblExecutionTime.Text = end.Subtract(start).Seconds + "." + end.Subtract(start).Milliseconds; Trace.Warn("It took " + time + " to execute page_load"); }
public void WriteText(System.IO.TextWriter writer, LogLevels level, DateTime dateTime, string text) { string sLevel; switch (level) { case LogLevels.Info: default: sLevel = "I"; break; case LogLevels.Diagnostic: sLevel = "D"; break; case LogLevels.Warning: sLevel = "W"; break; case LogLevels.Error: sLevel = "E"; break; } writer.WriteLine("{0}:{1} {2} [{4}]: {3}", sLevel, dateTime.ToShortDateString(), dateTime.ToLongTimeString(), text, Thread.CurrentThread.GetHashCode()); }
public void MarkCycleTime(DateTime time, bool success) { cycleItem.Show(); cycleTime.Text = "Recycled at " + time.ToLongTimeString(); failureItem.Visibility = success ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible; }
public Call(DateTime dateTime, string phoneNumber, int duration) { this.Date = dateTime.ToShortDateString(); this.Time = dateTime.ToLongTimeString(); this.DialedPhone = phoneNumber; this.DurationInSeconds = duration; }
void TmStopwatchTick(object sender, EventArgs e) { dtStopwatch = dtStopwatch.AddMilliseconds(100); tabPageList.dtList[tabPageList.Index - 1] = tabPageList.dtList[tabPageList.Index - 1].AddMilliseconds(100); lbStopwatchResult.Text = String.Format("{0}:{1}", dtStopwatch.ToLongTimeString(), dtStopwatch.Millisecond / 100); tabPageList.tabpLabel[tabPageList.Index - 1].Text = String.Format("{0}:{1}", tabPageList.dtList[tabPageList.Index - 1].ToLongTimeString(), tabPageList.dtList[tabPageList.Index - 1].Millisecond / 100); }
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 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 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()); }
private void QuantiseSelectedGUI() { EditorGUILayout.BeginVertical(GUI.skin.box); bookmarkNameIndex = EditorGUILayout.Popup("Bookmark Name", bookmarkNameIndex, assetInstance.BookmarkNames); int[] sessionIDs = assetInstance.BookmarkNameToSessionIDs[assetInstance.BookmarkNames[bookmarkNameIndex]]; sessionIDIndex = EditorGUILayout.IntSlider("Session ID Index", sessionIDIndex, 0, sessionIDs.Length - 1); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUI.skin.box); List <BaseSensorReading> sensorReadings = assetInstance.BookmarkNameToSessionIDToSensorReadingsListMap[assetInstance.BookmarkNames[bookmarkNameIndex]][sessionIDs[sessionIDIndex]]; EditorGUILayout.IntField("# Sensor Readings", sensorReadings.Count); EditorGUILayout.IntField("Session ID", sessionIDs[sessionIDIndex]); System.DateTime startTime = GetStartTimeInSensorReadingsList(sensorReadings); EditorGUILayout.LabelField("Start Time", startTime.ToLongTimeString()); System.DateTime endTime = GetEndTimeInSensorReadingsList(sensorReadings); EditorGUILayout.LabelField("End Time", endTime.ToLongTimeString()); EditorGUILayout.LabelField("Session Duration", (endTime - startTime).Duration().ToString()); EditorGUILayout.EndVertical(); if (GUILayout.Button("Quantise Selected Sensor Readings")) { FileHandler.WriteInputVectorsToFile(GetQuantisedSensorReadings(sensorReadings, startTime), targetDirectory + targetFilename, includeHeaders, appendDataToFile); } }
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"); }
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(); }
private void timer_Tick(object sender, EventArgs e) { _dtNow = DateTime.Now; DatetimeNow = _dtNow.ToLongTimeString(); _sec = _dtNow.Second; _min = _dtNow.Minute; _hor = _dtNow.Hour; _angle = Math.PI / 30 * _sec - Math.PI / 2; if (_lnHor != null && _lnMin != null && _lnHor != null) { _lnSec.X2 = 50 + Math.Cos(_angle) * _secLen; _lnSec.Y2 = 50 + Math.Sin(_angle) * _secLen; _angle = Math.PI / 1800 * (_min * 60 + _sec) - Math.PI / 2; _lnMin.X2 = 50 + Math.Cos(_angle) * _minLen; _lnMin.Y2 = 50 + Math.Sin(_angle) * _minLen; _angle = Math.PI / 21600 * (_hor * 3600 + _min * 60 + _sec) - Math.PI / 2; _lnHor.X2 = 50 + Math.Cos(_angle) * _horLen; _lnHor.Y2 = 50 + Math.Sin(_angle) * _horLen; } }
public int AddMedicineWarehouseInven(string fromid, string drugnum, string InventoryPer, string ActualCapacity, string InventoryStatus, string StorageCondition, string Rmarkes) { DataBaseLayer db = new DataBaseLayer(); String strSql = ""; int end = 0; System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now;//获取当前时间 System.DateTime nowtime = new System.DateTime(); nowtime = System.DateTime.Now; string t = nowtime.ToLongTimeString().ToString(); string date = currentTime.ToString("yyyy/MM/dd"); string time = t; strSql = "insert into WarehouseInvenmedical(Warehouse,InventoryPer,ActualCapacity,InventoryStatus,StorageCondition,time,date,remark,productbatch) "; strSql += "values ('" + fromid + "','" + InventoryPer + "','" + ActualCapacity + "','" + InventoryStatus + "','" + StorageCondition + "','" + time + "','" + date + "','" + Rmarkes + "','" + drugnum + "')"; if (strSql == "") { end = 0; } else { end = db.cmd_Execute(strSql); } return(end); }
protected void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString["key"] != null) { System.DateTime dStartTime = System.DateTime.Now; Response.Write("Start time: " + dStartTime.ToLongTimeString().ToString() + ".\r\n"); if ((new AdmPuMkDeploySystem()).UpdReleaseBuild(Int16.Parse(Request.QueryString["key"]), (new LoginSystem()).GetRbtVersion())) { Deploy dp = new Deploy(); base.CSrc = new CurrSrc(true, null); base.CTar = new CurrTar(true, null); string sbWarnMsg = dp.PrepInstall(Int32.Parse(Request.QueryString["key"]), base.CSrc, base.CTar, LcSysConnString, LcAppPw); if (sbWarnMsg != string.Empty) { PreMsgPopup(sbWarnMsg); } System.DateTime dEndTime = System.DateTime.Now; Response.Write("End time: " + dEndTime.ToLongTimeString().ToString() + ".\r\n"); Response.Write("Total lapsed time: " + ((System.TimeSpan)(dEndTime - dStartTime)).ToString() + "\r\n"); Response.Write("Deployment for release ID:" + Request.QueryString["key"] + " completed successfully.\r\n\r\n"); } else { Response.Write("Deployment for release ID:" + Request.QueryString["key"] + " aborted, please try again.\r\n\r\n"); } Response.End(); } }
/// <summary> /// Цифровые часы /// </summary> /// <param name="graphics"></param> public void DrawDigitalClock(Graphics graphics, Point point) { _time = DateTime.Now; graphics.DrawString(_time.ToLongTimeString(), new Font("Arial", 30), new SolidBrush(Color.Red), point); }
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); } }
private void CheckPause(string data) { if (data.Contains("recaptcha_response_field")) { StatusUpdate(this, new StatusChanged { ChangedData = ChangedType.Stop, Param = 1 }); return; } if (data.Contains("class=\"i3\"") || data.Contains("class=\"i4\"")) { StatusUpdate(this, new StatusChanged() { ChangedData = ChangedType.Stop, Param = 0 }); return; // no igm found, go on processing. } if(NextRead > DateTime.Now) return; // too short interval, go on pausing. data = this.pageQuerier.PageQuery(0, "nachrichten.php", null, true, true); if(data == null) return; // cannot read... network problem? int next = rand.Next(15,30); NextRead = DateTime.Now.AddMinutes(next); if(Regex.Match(data, "<a href=\"nachrichten.php[^\"]+\">" + RemoteStopWord + "</a>", RegexOptions.IgnoreCase).Success) { NextExec = DateTime.Now.AddMinutes(next + rand.Next(1,5)); DebugLog("Pause: To " + NextExec.ToLongTimeString(), DebugLevel.W); StatusUpdate(this, new StatusChanged() { ChangedData = ChangedType.Stop, Param = 1 }); } else StatusUpdate(this, new StatusChanged() { ChangedData = ChangedType.Stop, Param = 0 }); }
/// <summary> /// /************************************************************************************************ /// Populate CUSTOMER table /// By Wesley D. Brown /// Date 11/24/2007 /// Mod /// **Description** /// Functions: /// **End Discription** /// **Change Log** /// **End Change Log** /// ************************************************************************************************/ /// </summary> /// <returns></returns> public void BuildCustomerTable() { var currdate = new DateTime(); var dt = new DataTable(); var sqlConnect = new SqlConnection {ConnectionString = Sqlconn}; sqlConnect.Open(); var dc = new SqlCommand("select top 0 * from dbo.CUSTOMER", sqlConnect) {CommandType = CommandType.Text}; var da = new SqlDataAdapter(dc); da.FillSchema(dt, SchemaType.Mapped); sqlConnect.Close(); sqlConnect.Dispose(); var bulkCopy = new SqlBulkCopy(Sqlconn,SqlBulkCopyOptions.TableLock) {DestinationTableName = "dbo.CUSTOMER", BatchSize = 10000}; int i = NumWh; int tid = (NumWh*10*3000) + 1; while (i < MaxNumWh + 1) { for (int id = 1; id < 11; id++) { for (int cid = 1; cid < 3001; cid++) { DataRow dr = dt.NewRow(); dr["C_ID"] = "C_W" + i + "_D" + id + "_" + cid; dr["C_D_ID"] = "D_W" + i + "_" + id; dr["C_W_ID"] = "W_" + i; dr["C_FIRST"] = RandomString(5, 16); dr["C_MIDDLE"] = "oe"; dr["C_LAST"] = RandomString(8, 16); dr["C_STREET_1"] = RandomString(10, 20); dr["C_STREET_2"] = RandomString(10, 20); dr["C_CITY"] = RandomString(10, 20); dr["C_STATE"] = RandomString(2, 2); dr["C_ZIP"] = RandZip(); dr["C_PHONE"] = RandomString(12, 12); dr["C_SINCE"] = currdate.ToLongTimeString(); dr["C_CREDIT"] = "GC"; dr["C_CREDIT_LIM"] = 5000; dr["C_DISCOUNT"] = .5; dr["C_BALANCE"] = -10.00; dr["C_YTD_PAYMENT"] = 10.00; dr["C_PAYMENT_CNT"] = 1; dr["C_DELIVERY_CNT"] = 0; dr["C_DATA"] = RandomString(300, 500); dr["SEQ_ID"] = tid; dt.Rows.Add(dr); } } bulkCopy.WriteToServer(dt); dt.Clear(); i++; } return; }
/// <summary> /// Generates an entity tag for the given key and last modification date. /// </summary> /// <param name="key">The entity key</param> /// <param name="modified">The modification date</param> /// <returns></returns> private static string GenerateEtag(string key, DateTime modified) { UTF8Encoding encoder = new UTF8Encoding(); MD5CryptoServiceProvider crypto = new MD5CryptoServiceProvider(); string str = key + modified.ToLongTimeString(); byte[] bts = crypto.ComputeHash(encoder.GetBytes(str)); return Convert.ToBase64String(bts, 0, bts.Length); }
public LogEventArgs(string Node, DateTime logTime, string title, string Type, string Msg) { node = Node; type = Type; msg = Msg; dateTime = logTime.ToShortDateString() + "," + logTime.ToLongTimeString(); this.title = title; }
public CallLogModel(int CalleeID, DateTime StartTime) { this.CalleeID = CalleeID; this.StartTime = StartTime; this.logEntries = new EntitySet<CallLogEntry>(this.attachLog, this.detachLog); this._user = new EntityRef<UserModel>(); this.CallLogID = CalleeID.ToString() + "_" + StartTime.ToLongTimeString(); }
/*============================================================================*/ /* Public Functions */ /*============================================================================*/ public void Log (object source, robotlegs.bender.framework.impl.LogLevel level, DateTime timestamp, object message, params object[] messageParameters) { Console.WriteLine(timestamp.ToLongTimeString() + " " + level.ToString() + " " + _context + " " + source + " " + message, messageParameters); }
/*============================================================================*/ /* Public Functions */ /*============================================================================*/ public void Log (object source, robotlegs.bender.framework.impl.LogLevel level, DateTime timestamp, object message, params object[] messageParameters) { UnityEngine.Debug.Log(string.Format(timestamp.ToLongTimeString() + " " + level.ToString() + " " + _context + " " + source + " " + message, messageParameters)); }
public void Execute(string ipAddress) { Manager = new RedisManagerPool(ipAddress); StartedAt = DateTime.UtcNow; var q = new Timer { Interval = 1000 }; q.Elapsed += OnInterval; q.Enabled = true; using (PubSubServer = new RedisPubSubServer(Manager, Channel) { OnStart = () => { Console.WriteLine("OnStart: #" + Interlocked.Increment(ref StartCount)); }, OnHeartbeatSent = () => { Console.WriteLine("OnHeartbeatSent: #" + Interlocked.Increment(ref HeartbeatsSent)); }, OnHeartbeatReceived = () => { Console.WriteLine("OnHeartbeatReceived: #" + Interlocked.Increment(ref HeartbeatsReceived)); }, OnMessage = (channel, msg) => { Console.WriteLine("OnMessage: @" + channel + ": " + msg); }, OnStop = () => { Console.WriteLine("OnStop: #" + Interlocked.Increment(ref StopCount)); }, OnError = ex => { Console.WriteLine("OnError: #" + Interlocked.Increment(ref ErrorCount) + " ERROR: " + ex); }, OnFailover = server => { Console.WriteLine("OnFailover: #" + Interlocked.Increment(ref FailoverCount)); }, OnDispose = () => { Console.WriteLine("OnDispose: #" + Interlocked.Increment(ref DisposeCount)); }, OnUnSubscribe = channel => { Console.WriteLine("OnUnSubscribe: #" + Interlocked.Increment(ref UnSubscribeCount) + " channel: " + channel); }, }) { Console.WriteLine("PubSubServer StartedAt: " + StartedAt.ToLongTimeString()); PubSubServer.Start(); "Press Enter to Quit...".Print(); Console.ReadLine(); Console.WriteLine("PubSubServer EndedAt: " + DateTime.UtcNow.ToLongTimeString()); Console.WriteLine("PubSubServer TimeTaken: " + (DateTime.UtcNow - StartedAt).TotalSeconds + "s"); } }
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"); }
public void OnTimeChanged(TimePicker view, int hour, int minute) { mDate = new DateTime(mDate.Year, mDate.Month, mDate.Day, hour, minute, 0); Arguments.PutInt(EXTRA_HOUR, mDate.Hour); Arguments.PutInt(EXTRA_MINUTE, mDate.Minute); Console.WriteLine("Time Changed: {0}", mDate.ToLongTimeString()); }
// Static constructor to initialize the static variable. // It is invoked before the first instance constructor is run. static Bus() { globalStartTime = DateTime.Now; // The following statement produces the first line of output, // and the line occurs only once. Console.WriteLine("Static constructor sets global start time to {0}", globalStartTime.ToLongTimeString()); }
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) { } }
// 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"); }
/// <summary> /// Logs the error with datetime to C:\apps\FotmLogs\FotmErrorLog.log. /// Also writes the error to console by default, change bool param to flip. /// </summary> /// <param name="currentDateTime">The date and time of the error.</param> /// <param name="errorMessage">The error message to write.</param> /// <param name="type">The type of log message to write.</param> /// <param name="writeToConsole">Set to true if the error should also be written to the console.</param> public static void LogMessage(DateTime currentDateTime, string errorMessage, LogType type = LogType.Error, bool writeToConsole = true, bool isAsync = true) { var logType = type.ToString().ToUpper(); var error = $"{currentDateTime.ToLongTimeString()}--{logType.PadRight(10, '-')}{errorMessage}"; if (isAsync) LogMessageAsync(error); else LogMessage(error); Console.WriteLine(error); }
void Update() { System.DateTime curTime = System.DateTime.Now; _currentTime = (curTime.Hour * 60 + curTime.Minute) * 60 + curTime.Second; float value = _currentTime / DayLength; Light.color = LightColor.Evaluate(value); _dateText.text = curTime.ToLongTimeString(); _colorSample.color = Light.color; }
//functions to call when a new message is received void receiveMessage1(SimpleMessage[] sm) { rt1 = Time.time; Debug.Log(sm.Length); foreach (SimpleMessage smIn in sm) { GameObject clone; //check if the sender had the same name as me, and change the color if (smIn.sender == sender) //yo { clone = Instantiate(chatYo, chatYo.transform.position, chatYo.transform.rotation) as GameObject; clone.transform.SetParent(chatYo.transform.parent); clone.transform.Find("PanelC/Panel/PerfilMask/ImagePerfil").GetComponent <Image> ().sprite = userImage; } else { clone = Instantiate(chatEl, chatEl.transform.position, chatEl.transform.rotation) as GameObject; clone.transform.SetParent(chatEl.transform.parent); clone.transform.Find("PanelC/Panel/PerfilMask/ImagePerfil").GetComponent <Image> ().sprite = amigoImage; } //get date: System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); dateTime = dateTime.AddSeconds(Double.Parse(smIn.time.ToString())); string printDate = dateTime.ToShortDateString() + " " + dateTime.ToLongTimeString(); //sumScroll += clone.transform.GetComponent<Text> ().preferredHeight; //Debug.Log("preferredHeight: " +clone.transform.GetComponent<Text> ().preferredHeight); //yChatCount -= 0.5f; //clone.GetComponent<RectTransform>().pivot = new Vector2(GameObject.Find("PanelContent").GetComponent<RectTransform>().pivot.y, 0); clone.transform.localScale = new Vector3(1, 1, 1); clone.SetActive(true); //Debug.Log(smIn.message); clone.transform.Find("PanelC/PanelP/TextMgs").GetComponent <Text> ().text = smIn.message.Replace(" ", " "); clone.transform.Find("PanelC/PanelP/TextTime").GetComponent <Text> ().text = smIn.sender + " " + printDate; Debug.Log("dice q fecha: " + printDate); //ScrollObj.GetComponent<ScrollRect>().verticalNormalizedPosition = -1; //normalizedPosition //ScrollObj.GetComponent<RectTransform>().sizeDelta = new Vector2(ScrollObj.GetComponent<RectTransform>().rect.width, sumScroll); } //string _nID = ScheduleLocalNotification (CreateNotification (1, eNotificationRepeatInterval.NONE)); StartCoroutine(scrollDown()); }
public NoticeLabel(string Name, DateTime Time, double Offset) { InitializeComponent(); this.NoticeName = Name; this.NoticeTime = Time; this.Offset = Offset; NameLabel.Text = NoticeName; TimeLabel.Text = Time.ToLongTimeString(); }
public void setFields(int versionPK, int customerPK, DateTime expectedDate, string comment, int pk, int employeePK, bool? contacted, bool done) { currentPK = pk; currentCustomer = customerPK; currentVersion = versionPK; useActual.Checked = done; if (done) { wasDone = true; } else { wasDone = false; } string versionID = Database.getVersionID(versionPK); string customerName = Database.getCustomerName(customerPK); List<Employee> employeeList = Database.GetEmployeeList(); //employeeComboBox.DataSource employeeComboBox.ValueMember = "PK"; employeeComboBox.DisplayMember = "Name"; employeeComboBox.DataSource = employeeList; employeeComboBox.SelectedIndex = employeeList.FindIndex(k => k.PK == employeePK); //employeeComboBox.ValueType = typeof(Employee); versionLabel.Text = "Version: " + versionID; customerLabel.Text = "Customer: " + customerName; commentsTextBox.Text = comment; if (expectedDate != System.DateTime.MinValue) { expectedDatePicker.Text = expectedDate.ToShortDateString(); expectedTimePicker.Text = expectedDate.ToLongTimeString(); actualDatePicker.Text = DateTime.Now.ToShortDateString(); actualTimePicker.Text = DateTime.Now.ToLongTimeString(); } if (contacted == true) { contactedCB.Checked = true; this.wasContacted = true; } else { contactedCB.Checked = false; this.wasContacted = false; } }
public static void Log(string msg) { System.DateTime now = System.DateTime.UtcNow; String time = now.ToLongTimeString() + ":" + now.Millisecond; #if UNITY_EDITOR // Development mode! Debug.Log(time + " ~ " + msg); #else // Release mode! // TODO: What to do with the logging info? #endif }
private void cmdViewResults_Click(object sender, EventArgs e) { string ret = "<html>" + "\r\n" + " <head>" + "\r\n" + " <title>Chanmongler Search Results</title>" + "\r\n" + " <style type=\"text/css\" media=\"screen\">" + "\r\n" + " td { padding: 3px; }" + "\r\n" + " </style>" + "\r\n" + " </head>" + "\r\n" + " <body><center>" + "\r\n" + " <font size=+3>" + "\r\n" + " Search completed at " + dtLastSearch.ToShortDateString() + " - " + dtLastSearch.ToLongTimeString() + "\r\n" + " </font>" + "\r\n" + " <br><br>" + "\r\n" + " <table border=2>" + "\r\n"; string[] saFoundWrd = sFoundWrd.Split('\n'); string[] saFoundURL = sFoundURL.Split('\n'); string[] saFoundCtx = sFoundCtx.Split('\n'); for (int a = 0; a < saFoundURL.Length; a++) { ret += " <tr>" + "\r\n" + " <td>" + saFoundWrd[a] + "</td>" + "\r\n" + " <td><a href=\"" + saFoundURL[a] + "\">" + saFoundURL[a] + "</td>" + "\r\n" + " <td>" + saFoundCtx[a] + "</td>" + "\r\n" + " </tr>" + "\r\n"; } ret += " </table>" + "\r\n" + " <a href=\"" + frmMain.ToxDomain + "\">" + "\r\n" + " <font color=\"#777777\">" + "\r\n" + " Praetox Technologies" + "\r\n" + " </font>" + "\r\n" + " </a>" + "\r\n" + " </body>" + "\r\n" + "</html>"; try { System.IO.File.WriteAllText("srch.html", ret, Encoding.UTF8); System.Diagnostics.Process.Start("srch.html"); } catch { MessageBox.Show( "Unable to view the search result website." + "\r\n" + "\r\n" + "Did you forget to close the previous search results?"); } }
public string ToString(bool bCompact) { return("------------------\n" + "Key[" + Table + "]" + " RequestType[" + RequestType + "] " + " ResponseType[" + ResponseType + "]" + " SizeResponse[" + ToSizeString(SizeResponse) + "]" + " SizeRequest[" + ToSizeString(SizeRequest) + "]" + " at " + Date.ToLongTimeString() + "." + "\n - Request: " + GetRequest(bCompact).Replace("\n", "\n\t\t") + "." + "\n - Response: " + GetResponse(bCompact).Replace("\n", "\n\t\t") + "." + "\n - Stack: " + GetStack(bCompact).Replace("\n", "\n\t\t") + "." ); }
public string CriarTemporaria(string cSql, string cCamposAdicionais = "", string cName = "") { string cNameTmp = ""; string cSqlCreate = ""; System.DateTime DataHoje = DateTime.Now; if (cName != string.Empty) { cNameTmp = cName; } else { cNameTmp = "tmp" + DataHoje.ToLongTimeString().Replace(":", "") + DataHoje.Millisecond.ToString(); } cSqlCreate = "CREATE TEMPORARY TABLE IF NOT EXISTS " + cNameTmp; if (cSql == string.Empty) { cSqlCreate += "( tmp_id serial primary key " + FuncoesGerais.IIf(cCamposAdicionais != string.Empty, "," + cCamposAdicionais, "") + ");"; } else { cSqlCreate += " as " + cSql + ";"; cSqlCreate += " ALTER TABLE " + cNameTmp + " ADD COLUMN tmp_id SERIAL PRIMARY KEY;"; if (cCamposAdicionais != string.Empty) { cSqlCreate += " ALTER TABLE " + cNameTmp + " ADD COLUMN " + cCamposAdicionais + ";"; } } try { ExecutarSql(cSqlCreate); } catch (Exception ex) { MessageBox.Show("Erro na criação da temporaria:" + ex.Message); } return(cNameTmp); }
protected void Page_Load(object sender, EventArgs e) { System.DateTime start = System.DateTime.Now; //Thread.Sleep(3000); if (!Page.IsPostBack) { DataView dw = new DataView(((DataLayer)Application["DataLayer"]).GetFeaturedProducts()); dlFeatured.DataSource = dw; dlFeatured.DataBind(); } System.DateTime end = System.DateTime.Now; lblStartTime.Text = start.ToLongTimeString(); lblExecutionTime.Text = end.Subtract(start).Seconds + "." + end.Subtract(start).Milliseconds; }
IEnumerator Start() { if (energyOn) { yield return(new WaitForEndOfFrame()); if (PlayerPrefs.HasKey("Energy")) { energyFullAt = System.DateTime.Parse(PlayerPrefs.GetString("EnergyFullAt")); Debug.Log(energyFullAt.ToLongTimeString()); } else { PlayerPrefs.SetInt("Energy", 7); } } }
static StackObject *ToLongTimeString_2(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)); var result_of_this_method = instance_of_this_method.ToLongTimeString(); 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 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 void Main() { // Create an array of culture names. String[] names = { "en-US", "en-GB", "fr-FR", "de-DE" }; // Initialize a DateTime object. DateTime dateValue = new System.DateTime(2013, 5, 28, 10, 30, 15); // Iterate the array of culture names. foreach (var name in names) { // Change the culture of the current thread. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(name); // Display the name of the current culture and the date. Console.WriteLine("Current culture: {0}", CultureInfo.CurrentCulture.Name); Console.WriteLine("Date: {0:G}", dateValue); // Display the long time pattern and the long time. Console.WriteLine("Long time pattern: '{0}'", DateTimeFormatInfo.CurrentInfo.LongTimePattern); Console.WriteLine("Long time with format string: {0:T}", dateValue); Console.WriteLine("Long time with ToLongTimeString: {0}\n", dateValue.ToLongTimeString()); } }
void UpdateLocDisp() { if (Input.location == null) { Status.text = "Input.location was null"; return; } if (Input.location.status == LocationServiceStatus.Failed) { Status.text = "Input.location failed"; return; } if (Input.location.status != LocationServiceStatus.Running) { Status.text = string.Format("Input.location.status was not running, status={0}", Input.location.status); return; } Status.text = string.Format( "Running... (x,y) = ({0}, {1})", MapUtils.LonToX(Input.location.lastData.longitude), MapUtils.LatToY(Input.location.lastData.latitude) ); System.DateTime dt = Locator.UnixTimeStampToDateTime(Input.location.lastData.timestamp); int lblCols = 0; LastUpdate.text = string.Format("{0}: {1} {2}", "Last Update".PadLeft(lblCols), dt.ToShortDateString(), dt.ToLongTimeString()); Altitude.text = string.Format("{0}: {1:N7}", "Altitude".PadLeft(lblCols), Input.location.lastData.altitude); Latitude.text = string.Format("{0}: {1:N7}", "Latitude".PadLeft(lblCols), Input.location.lastData.latitude); Longitude.text = string.Format("{0}: {1:N7}", "Longitude".PadLeft(lblCols), Input.location.lastData.longitude); Accuracy_Horiz.text = string.Format("{0}: {1}", "Horizontal Acc".PadLeft(lblCols), Input.location.lastData.horizontalAccuracy); Accuracy_Vert.text = string.Format("{0}: {1}", "Vertical Acc".PadLeft(lblCols), Input.location.lastData.verticalAccuracy); }
public static string FormatDateTimeLong(System.DateTime Expression) { //return String.Format(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern, Expression); return(Expression.ToLongDateString() + " " + Expression.ToLongTimeString()); }
public void DepleteEnergy() { if (!PlayerPrefs.HasKey("BrawlPro") && energyOn) { if (PlayerPrefs.GetInt("Energy") > 0) { if (PlayerPrefs.GetInt("Energy") == 7) { energyFullAt = System.DateTime.Now.AddMinutes(5); PlayerPrefs.SetString("EnergyFullAt", energyFullAt.ToLongTimeString()); Debug.Log(energyFullAt.ToLongTimeString()); } else { energyFullAt = energyFullAt.AddMinutes(5); PlayerPrefs.SetString("EnergyFullAt", energyFullAt.ToLongTimeString()); Debug.Log(energyFullAt.ToLongTimeString()); } PlayerPrefs.SetInt("Energy", PlayerPrefs.GetInt("Energy") - 1); } else { GameObject confirm; if (GameObject.Find("Canvas/Energy")) { confirm = GameObject.Find("Canvas/Energy"); } else if (GameObject.Find("PlayerUI/Energy")) { confirm = GameObject.Find("PlayerUI/Energy"); } else { confirm = null; } if (confirm != null) { confirm.transform.GetChild(1).GetChild(0).GetComponent <TMPro.TMP_Text>().text = "No Energy!"; confirm.transform.GetChild(1).GetChild(1).GetChild(1).GetComponent <TMPro.TMP_Text>().text = "You have used all your energy :(, would you like to watch an ad to refill it instantly? P.S; It will refill by itself over time."; confirm.GetComponent <Animator>().SetTrigger("Entry"); foreach (Image image in confirm.GetComponentsInChildren <Image>()) { image.enabled = true; } foreach (TMPro.TextMeshProUGUI text in confirm.GetComponentsInChildren <TMPro.TextMeshProUGUI>()) { text.enabled = true; } foreach (TMPro.TMP_Text text in confirm.GetComponentsInChildren <TMPro.TextMeshProUGUI>()) { text.enabled = true; } if (confirm.GetComponent <Image>()) { confirm.GetComponent <Image>().enabled = true; } if (confirm.GetComponent <TMPro.TextMeshProUGUI>()) { confirm.GetComponent <TMPro.TextMeshProUGUI>().enabled = true; } if (confirm.GetComponent <TMPro.TMP_Text>()) { confirm.GetComponent <TMPro.TMP_Text>().enabled = true; } confirm.transform.GetChild(1).GetChild(1).GetChild(2).GetComponent <Button>().onClick.AddListener(WatchAd); } } } PlayerPrefs.Save(); }
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); } } }
/// <summary> /// Formatted time into a string: 'MM/DD/YYYY hh:mm:ss AM/PM' /// </summary> public static string GetCurrentComputerDate() { System.DateTime time = System.DateTime.Now; return(time.ToShortDateString() + " " + time.ToLongTimeString()); }
// Update is called once per frame void Update() { System.DateTime now = System.DateTime.Now; GetComponent <Text>().text = now.ToLongTimeString(); }