我想根据当天的时间从我的 google places json 响应中获取关闭时间。这行代码为我提供了一周中当前日期的 0-6 值。
NSString *dayOfWeek = [myFormatter stringFromDate:today];
我有一个 NSArray 来存储谷歌位置响应的结果。
NSArray* periods= [[place objectForKey:@"opening_hours"]objectForKey:@"periods"];
period 数组中的 json 响应如下所示。
Period RESULT (
{
close = {
day = 0;
time = 2300;
};
open = {
day = 0;
time = 1100;
};
},
{
close = {
day = 1;
time = 2300;
};
open = {
day = 1;
time = 1100;
};
},
{
close = {
day = 2;
time = 2300;
};
open = {
day = 2;
time = 1100;
};
},
{
close = {
day = 3;
time = 2300;
};
open = {
day = 3;
time = 1100;
};
},
{
close = {
day = 4;
time = 2300;
};
open = {
day = 4;
time = 1100;
};
},
{
close = {
day = 5;
time = 2300;
};
open = {
day = 5;
time = 1100;
};
},
{
close = {
day = 6;
time = 2300;
};
open = {
day = 6;
time = 1100;
};
}
)
如何使用我的 dayOfWeek 值来检查 period 数组的正确 close.time?