SQLite Date format changes

Discussion in 'Questions (Windows Mobile)' started by mikewhite, Jun 19, 2009.

  1. mikewhite

    mikewhite Member Licensed User

    Hi,

    I've gone back to a 6.5 project and am now changing it in 6.8

    Am I right in thinking that the date format returned from SQLite databases is now different? I'm pretty sure I used to get date/times back like this

    yyyy/mm/dd but now see them in dd/mm/yyyy (UK - where I am) format.

    Is this how its supposed to be? I want to make sure before I adjust my code.

    Thanks

    Mike
     
  2. berndgoedecke

    berndgoedecke Active Member Licensed User

    SQL DateFormat

    Hello Mike,
    the date should be formated as it is configured in the
    Regional Settings.

    Best regards
    Bernd Goedecke
     
  3. mikewhite

    mikewhite Member Licensed User

    Thanks for that. What I've found is that I now have to select datetimestamp fields like this:

    select datetime(fieldinquestion)

    to get it in the form I was expecting, and was the default, of yyyy-mm-dd

    Mike
     
  4. ayman12

    ayman12 Member Licensed User

    It look like in SQLite there is no data type, i.e all the data have the same type which is text, but the type you put in the create SQL command is the prefared type.
    (some body has to fix me if it is worng).

    see
    Datatypes In SQLite Version 3

    and this
    SQLite Frequently Asked Questions

    so i prefare if you put you date value as yyyymmdd-hhmmss
    I made function to convert to this format.
    some thing like this

    '-----------------------
    Sub MainSub
    MsgBox (MySub(NOW))
    End Sub
    '------------------------
    Sub MySub (lngNow)
    Dim strCurrDate
    DateFormat ("yyyymmdd")
    strCurrDate = Date(lngNow)
    Return strCurrDate
    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice