如何将Unix时间戳转换为日期时间,反之亦然?
public Double CreatedEpoch{ get { DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime(); TimeSpan span = (this.Created.ToLocalTime() - epoch); return span.TotalSeconds; } set { DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime(); this.Created = epoch.AddSeconds(value); }}
人到中年有点甜
牛魔王的故事
慕仙森