当前位置:网站首页>Nlog自定义时间
Nlog自定义时间
2022-08-02 22:25:00 【@榴莲酥】
第一步重写 TimeSource类
/// <summary>
/// 自定义时间,网关里是的标准时间,这里我修改成北京时间
/// </summary>
[TimeSource("CustomTimeZone")]
public class CustomTimeZoneTimeSource : TimeSource
{
public override DateTime Time
{
get
{
return DateTime.UtcNow.AddHours(8);//这里你可以自定义返回时间
}
}
public override DateTime FromSystemTime(DateTime systemTime)
{
return DateTime.UtcNow.AddHours(8);//这里你可以自定义返回时间
}
}第二步,实现刚才重写的类,即可
TimeSource.Current = new CustomTimeZoneTimeSource();
GitHub Nlog自定义时间说明地址:
边栏推荐
- 成功解决TypeError: can‘t multiply sequence by non-int of type ‘float‘
- GameStop NFT 市场分析
- 搭建直播平台,使用node生成验证码图片,并进行验证
- 非关系型数据库MongoDB简介和部署
- js function anti-shake and function throttling and other usage scenarios
- word操作:单独调整英文字体
- resubmit 渐进式防重复提交框架简介
- TDengine 在中天钢铁 GPS、 AIS 调度中的落地
- Teach you how to kill if else
- PHP实现登录失败三次需要输入验证码需求
猜你喜欢
随机推荐
Go语言如何操作文件
GameStop NFT 市场分析
TCP三次握手与四次挥手
多租户的多种实现方案
目前为止 DAO靠什么盈利?
centos7安装mysql5.7
创建型模式 - 单例模式Singleton
刚安装完win10专业工作站版,系统变量中Path默认值有哪些?重新建一个“PATH”变量名,会覆盖掉原先的“Path”。
B站回应HR称用户是Loser:涉事面试官去年底已被劝退
用于中文文本分类的中文停用词
wallys/new product/WiFi6 MiniPCIe Module 2T2R 2×2.4GHz 2x5GHz MT7915 MT7975
gdb调试简要总结
记一次mysql查询慢的优化历程
Sentinel vs Hystrix 限流对比,到底怎么选?
msys2下载地址
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
Web APIs BOM- 操作浏览器-Window对象
Word2Vec词向量训练、使用及可视化操作
MySQL 用id分库使用name查询
Based on two levels of decomposition and the length of the memory network multi-step combined forecasting model of short-term wind speed









