首页 > 编程语言 > 详细

arcgis python 更新日期为随机数

时间:2019-09-03 11:03:40      阅读:105      评论:0      收藏:0      [点我收藏+]
#coding:UTF-8
import time
import random
import re

# 根据时间返回,返回随机年月日时间
def getRandomDate(sYear, sMonth, sDay, eYear, eMonth, eDay):
    a1=(sYear,sMonth,sDay,0,0,0,0,0,0)
    a2=(eYear,eMonth,eDay,23,59,59,0,0,0)
    start=time.mktime(a1)
    end=time.mktime(a2)
    t=random.randint(start,end)
    date_touple=time.localtime(t)
    date=time.strftime("%Y/%m/%d",date_touple)
    return date

调用:getRandomDate(2010,1,1,2019,1,1)

arcgis python 更新日期为随机数

原文:https://www.cnblogs.com/gisoracle/p/11451569.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!