Generates a random date string that is used to insert the database.A time period is set by a time tuple, and the start and end times are converted to timestamps.Randomly take one of the timestamps, then generate a time tuple, and then format the time tuple as a stringThe Python2 code is as followsImport timeImport Randoma1= (1976,1,1,0,0,0,0,0,0) #设置开始日期时间元组 (1976-01-01 00:00:00)A2= (1990,12,31,23,59,59,0,0
Label:20150510 Insert a random date add_time (int) in the table, 2014 random dates, preferably every monthDue to the time stamp format stored, one months difference 2678400, a day difference of 86400The function to useSELECT unix_timestamp (' 20141231 ') #1419955200SELECT from_unixtime (1391675501, '%y%m%d%h:%i:%s ')SELECT Floor (1 + (RAND () *)) #随机月份SELECT Floo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.