Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Date issue with SQLite
Forum Updated to NodeBB v4.3 + New Features

Date issue with SQLite

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dolevo
    wrote on 8 Feb 2015, 08:11 last edited by
    #1

    Hi,

    I have a database application in Qt and it uses SQLite. In the beginning, I stored all the dates as string in the database in "dd.MM.yyyy" format. Now, I need to use the following SQL statement but it doesn't work out:

    @SELECT sold_date, title, sold_price FROM adv WHERE userid=2 AND sold_date > '01/01/2015'

    Is there any way to convert my column to a comparable format in an easy way? Otherwise I need to change the format to another one that SQLite understands I suppose. Could anyone help me out?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dolevo
      wrote on 8 Feb 2015, 09:17 last edited by
      #2

      Never mind, I have all the data in the date column in "yyyy-MM-dd" format and now it works as expected.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bagavathikumar
        wrote on 9 Feb 2015, 11:38 last edited by
        #3

        The default date format is YYYY-MM-DD only. So write a small code to change the format of the value, then change the data type of the column.

        1 Reply Last reply
        0

        2/3

        8 Feb 2015, 09:17

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved