In my Parse database, it having a column as Time, so the data of it is (08:30 - 10:30) *just for an example. It is the String value, since the Parse doesn't support for the Date Time. What if I want to query the time which is 09:00, how should I query this? I'm trying to do like this...
在我的Parse数据库中,它有一列作为Time,所以它的数据是(08:30 - 10:30)*仅作为示例。它是String值,因为Parse不支持Date Time。如果我想查询09:00的时间怎么办,怎么查询呢?我想这样做......
var query = PFQuery(className: "Timetable")
query.wherekey("Time".substringToIndex(advance(1,5)), greatherThanOrEqualTo: "09:00")
But it doesn't work and showing error as well, how should I query it so that it can validate 09:00 is in the middle of that time?
但是它不起作用并且也显示错误,我应该如何查询它以便它可以在09:00处于中间时间进行验证?
You can see the example of my Parse Class here, the Time is look like that, what if I want to query is my time is in the middle of that time duration?
你可以在这里看到我的Parse Class的例子,时间看起来像那样,如果我想查询的是我的时间是在那段时间的中间?
1 个解决方案
#1
0
Its a shame that parse doesn't support importation of dates via CSV, but the database supports date types, and it seems that's what you need.
遗憾的是,解析不支持通过CSV导入日期,但数据库支持日期类型,这似乎就是您所需要的。
I would perform a function after the import to parse the string column and create dates. From the strings in the question, it looks like the object needs start date and end date attributes. Maybe duration would be handy also.
我会在导入后执行一个函数来解析字符串列并创建日期。从问题中的字符串看,对象需要开始日期和结束日期属性。也许持续时间也很方便。
The benefits of doing this are (a) the dates can be represented unambiguously as UTC, (b) you'll have a chance to query on them, including inequalities like greaterThan, lessThan.
这样做的好处是(a)日期可以明确地表示为UTC,(b)您将有机会查询它们,包括不等式,如greaterThan,lessThan。
#1
0
Its a shame that parse doesn't support importation of dates via CSV, but the database supports date types, and it seems that's what you need.
遗憾的是,解析不支持通过CSV导入日期,但数据库支持日期类型,这似乎就是您所需要的。
I would perform a function after the import to parse the string column and create dates. From the strings in the question, it looks like the object needs start date and end date attributes. Maybe duration would be handy also.
我会在导入后执行一个函数来解析字符串列并创建日期。从问题中的字符串看,对象需要开始日期和结束日期属性。也许持续时间也很方便。
The benefits of doing this are (a) the dates can be represented unambiguously as UTC, (b) you'll have a chance to query on them, including inequalities like greaterThan, lessThan.
这样做的好处是(a)日期可以明确地表示为UTC,(b)您将有机会查询它们,包括不等式,如greaterThan,lessThan。