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
QtWS25 Last Chance

Date issue with SQLite

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 989 Views
  • 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 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 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
      • bagavathikumarB Offline
        bagavathikumarB Offline
        bagavathikumar
        wrote on 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

        • Login

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