本文主要是介绍火车头采集器——运行C#代码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
火车头采集器,内容采集规则中出现时间戳格式的,选择 数据处理—高级功能—运行C#代码
public string Run(string content,ResponseEntry response){ulong a = ulong.Parse(content);content = GetDateTimeFrom1970Ticks(a).ToString();return content;}public static String GetDateTimeFrom1970Ticks(ulong curSeconds){DateTime nowTime;if (curSeconds.ToString().Length == 13){nowTime = new DateTime(1970, 1, 1, 8, 0, 0).AddMilliseconds(curSeconds);}else{nowTime = new DateTime(1970, 1, 1, 8, 0, 0).AddSeconds(curSeconds);}return nowTime.ToString();}
点个关注,不定期的发布有关采集器的文章和我的技巧。
这篇关于火车头采集器——运行C#代码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!