ArcMap中毫秒转换为日期格式

参考http://blog.csdn.net/muzilanlan/article/details/45647883

最近遇到一个问题,需要将shp图层中的毫秒值转换日期格式,参考上面的文章,自己进行了如下修改:

import time
#秒转换为日期
def Time2ISOString(s):
    if (s.strip() and not s.__contains__("-")):
        return time.strftime("%Y-%m-%d", time.localtime(float(s) / 1000))
    else: return s


print Time2ISOString("1456531200000");
在ArcMap中调用
 
  
即可得到结果

你可能感兴趣的:(ArcMap中毫秒转换为日期格式)