English 中文(简体)
沉积和沉积来自 and体和roid体的数据的问题
原标题:Issues in storing and retrieving data from sqlite in android

我正试图从数据库中检索数据,询问如下:

select * from Oil Where date(DDate)=date( 2012-08-07 );

where DDate is one of the column in the Oil table with datatype text.I get the Arrayindexoutofboundsexception. I found that it is not returning any value the count is 0. can anyone help me with this.What i am actually trying is to do is store date value in the table.I couldn t find which datatype should be used to save date,from the sqlite site is that it doesn t have a particular datatype for date and time.

最佳回答

页: 1 服务器有以下数据类型,用于储存数据库的日期或日期/时间价值:

<><><>>>>> - 格式 YYYY-MM-DD

<> - 格式:YYYY-MM-DD HH:MM:SS

http://www.ohchr.org。 - 格式:YYYY-MM-DD HH:MM:SS

select * from Oil Where date(DDate)=date( 2012-08-07 );

can be

select * from Oil Where DDate= 2012-08-07 ;
问题回答

如果你在日期格式上有了DDN,那么你可以直接比较使用日期。

select * from Oil Where DDate= 2012-08-07 ;

否则的话,如果你在日期格式上做到了DDyy-MM-dd HH:mm:ss when the query look as this

select * from Oil Where date(DDate)= 2012-08-07 ;

如果你在qlite数据库中保留了日期,并且你必须履行诸如分类或使用日期和时间()等职能,那么你必须使用yyyy-MM-ddd。 HH:mm:sdate Format.

数据型确实是 s。





相关问题
Weird Time Issue in Python

Problem with using times in Python. Terminal > Python >>> calendar.timegm(datetime.datetime.now().utctimetuple()) 1258449380 This time indicates GMT: Tue, 17 Nov 2009 09:16:20 GMT Eclipse ...

How does a .NET process get the culture information?

I have a Windows service running (C#, .NET 2.0) on Windows Server 2003 R2. In one server the System.Threading.Thread.CurrentThread.CurrentCulture is {en-AU} and in the other {en-US}. This has caused a ...

Best way to get maximum Date value in java?

I m writing a bit of logic that requires treating null dates as meaning forever in the future (the date in question is an expiration date, which may or may not exist). Instead of putting in special ...

Date format in SQL Server

Short Question: What s the best date format to use in SQL Server? Long Explanation: We re converting our database from mysql to SQL Server. In mysql we always used int(11) to avoid the daylight ...

Converting asp.net/sql web app to be ime zone savy

Our current app stores all dates via the server s datetime. I m thinking we need to update all datetime values in the database over to UTC time. Now for displaying these dates back to the user, I ...

Check if string is of SortableDateTimePattern format

Is there any way I can easily check if a string conforms to the SortableDateTimePattern ("s"), or do I need to write a regular expression? I ve got a form where users can input a copyright date (as a ...

DateTime in PropertyGrid in .Net

I m currently working on some DateTime properties in a PropertyGrid in c#.Net. Im using the default drop-down datetime picker. My question: Is there any way to show the full date with the time? By ...

热门标签