DateTime.ToString Method (String)

Converts the value of the current DateTime object to its equivalent string representation using the specified format.

 

 

//DateTime.Now.GetDateTimeToLongTimeStamp() 扩展获取毫秒级 时间戳 // ParseStrToDouble 数值转双精度 var client = _httpclientfactory.CreateClient(); var httprequest = new HttpRequestMessage(); // 获取温度区间 httprequest.RequestUri = new Uri("http://d1.weather.com.cn/dingzhi/101230201.html?_=" + DateTime.Now.GetDateTimeToLongTimeStamp()); //下方无温度区间 //httprequest.RequestUri = new Uri("http://d1.weather.com.cn/sk_2d/101230201.html?_="+DateTime.Now.GetDateTimeToLongTimeStamp()); httprequest.Method = HttpMethod.Get; httprequest.Headers.Add("Referer", "http://www.weather.com.cn/"); try { var data = await client.SendAsync(httprequest); var str = await data.Content.ReadAsStringAsync(); str = GetJson(str); var json = JObject.Parse(str); model.TemperatureSection = (json["weatherinfo"]["tempn"].ToString() + " ~ " + json["weatherinfo"]["temp"].ToString()).Replace("℃", ""); var httprequest1 = new HttpRequestMessage(); httprequest1.RequestUri = new Uri("http://d1.weather.com.cn/sk_2d/101230201.html?_=" + DateTime.Now.GetDateTimeToLongTimeStamp()); httprequest1.Method = HttpMethod.Get; httprequest1.Headers.Add("Referer", "http://www.weather.com.cn/"); var data1 = await client.SendAsync(httprequest1); var str1 = await data1.Content.ReadAsStringAsync(); str1 = GetJson(str1); var json1 = JObject.Parse(str1); model.Name = json1["weather"].ToString().Replace("天", ""); model.Temperature = json1["temp"].ToString().ParseStrToDouble(); model.Humidity = json1["SD"].ToString().Replace("%", "").ParseStrToDouble(); model.CO = 0; model.PM25 = json1["aqi_pm25"].ToString().ParseStrToDouble(); model.AirLevel = GetAirLevel(json1["aqi"].ToString()); model.Wind = json1["WD"].ToString(); client.Dispose(); _cache.Write(cacheKey, model); } catch (Exception ex) { model.Desc = ex.Message; } private string GetJson(string str) { var start = str.IndexOf('{'); var end = str.IndexOf(';'); start=start <= 0 ? 0 : start; return end>0? str.Substring(start,end-start):str.Substring(start); } 转换成 ts
最新发布
10-23
string sql = "select XX from I_D1490703bd2f095606f478690eb4f7dff7f96f0" ; DataTable dt = engine.Query.QueryTable(sql, null); string owner="da1573cf-b04c-4e1e-b203-94bcd76e83f0"; //郭清 //string owner = "c7003f5d-9b13-47f8-b2ca-d0b9215eb546"; //蒋新宇 foreach(DataRow XObject in dt.Rows) { string xx = XObject["XX"].ToString(); H3.DataModel.BizObjectSchema aSchema = engine.BizObjectManager.GetPublishedSchema("D149070sh45bmbdqcuimcpctmd3h"); H3.DataModel.BizObject aBo = new H3.DataModel.BizObject(engine, aSchema, owner); aBo.CreatedBy = owner; aBo.OwnerId = owner; aBo["F0000018"] = xx; aBo["WCRQ"] = ""; aBo["SysDate"] = DateTime.Today.ToString("yyyy-MM-dd"); aBo.Status = H3.DataModel.BizObjectStatus.Effective; string instanceId = System.Guid.NewGuid().ToString(); if(string.IsNullOrEmpty(aBo.WorkflowInstanceId)) { aBo.WorkflowInstanceId = instanceId; } var errorCode = aBo.Create(); //创建对象 H3.Workflow.Instance.WorkflowInstance wfInstance = engine.WorkflowInstanceManager.GetWorkflowInstance(aBo.WorkflowInstanceId); if(wfInstance == null && errorCode != ErrorCode.ValidateNoRepeatRuleFailed) { //启动流程 string workItemID = string.Empty; string errorMsg = string.Empty; H3.Workflow.Template.WorkflowTemplate wfTemp = engine.WorkflowTemplateManager.GetDefaultWorkflow(aBo.Schema.SchemaCode); engine.WorkflowInstanceManager.OriginateInstance(owner, aBo.Schema.SchemaCode, wfTemp.WorkflowVersion, aBo.ObjectId, aBo.WorkflowInstanceId, H3.Workflow.WorkItem.AccessMethod.Web, true, string.Empty, true, out workItemID, out errorMsg);解析此段代码
09-18
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值