我使用下面的代码来获取组件的日期。我有一个2017-01-08 18:38:00 UTC
。我使用下面的代码来获取它的日期。
var components = calendar.dateComponents([.year, .month, .day,.weekday
], from: eventModel.start_date!)
print("component day is \(String(describing: components.day!))")
但是当我打印那天它给我一天9而不是8那么代码的问题是什么。请指导我如何改进这个东西。
答案 0 :(得分:0)
打印(calendar.timeZone)。我认为那是你当地的时区。
---------更新-----------
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://creator.zoho.com/api/json/western-states-healthcare-group-2-0/view/Providers_Report?authtoken=b627006529f0d19852608be37d4bdf85&zc_ownername=nmormond&criteria=(Provider_Name%3D%3D%22Injury%2520Treatment%2520Centers%2520Redwood%22)&scope=creatorapi",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET"
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}