我有一个从ajax和控制器恢复的变量
new_df = df.apply(_update, axis=1)
>>> new_df
measure amount
precip
1 cm3/year 16425
2 cm3/year 48180
3 cm3/year 9565
4 cm3/year 157680000
5 cm3/year 24455
6 cm3/year 18980
7 cm3/year 63072000
8 cm3/year 28470
9 cm3/year 94608000
10 cm3/year 33580
# Save de new file:
new_df.to_excel('new_file.xlsx')
结果:false
我的问题是如何将字符串转换为在基本HoursPass中看到的时间戳为时间戳类型
答案 0 :(得分:0)
最好从一个长的真实时间戳开始。但是否则您可以通过以下方式做到这一点:
$gethour = "Sat Oct 26 2019 00:00:04 GMT+0200 (heure d’été d’Europe centrale)";
$chunks = explode(' ', $gethour);
$from = new \DateTime($chunks[1] . ' ' . $chunks[2] . ' ' . $chunks[3] . ' ' . $chunks[4]);
$from->setTimezone(new DateTimeZone($chunks[5]));
echo $from->format('d-m-Y H:i:s P'); // 26-10-2019 09:00:04 +02:00
答案 1 :(得分:-1)
您可以通过这种方式进行检查:
date("m-d-y H:i:s", strtotime($gethour));
这种方式为我解答。