SQLITE DATES VS XOJO DATES

My question is about sqlite dates.
From looking online, I notice sqlite date values are formatted YYYY-MM-DD
depending on the operating system format of the user’s country, the date in xojo will be a different format(like the UK or me (NZ))
I reparsed this by getting the recordset of “started” (which is a date in my database)
a=rs.field(“Started”).StringValue
olddate.Year=val(a.left(4))
olddate.month=val(a.mid(6,2))
olddate.Day=val(a.left(2))

my direct question is this. I’m trying to see if todays date is more than 10 days after the OLDDATE (rs.field(“Started”).StringValue)
did I pull it off with the code below? You may ask me to try it - but my database is online and it’s not yet created.

rs = GraphicBD.SQLSelect("select Started from Identify where PersonID='1'") dim d as new date dim a as string dim olddate as new date a=rs.field("Started").StringValue olddate.Year=val(a.left(4)) olddate.month=val(a.mid(6,2)) olddate.Day=val(a.left(2)) olddate.day=olddate.day+10 if d>olddate then 'do some code here end if

Or you can do rs.field(“Started”).DateValue

Also, you could do olddate.SQLDate = a.

Let the database do the work for you. Add the date check to the ‘WHERE’ clause in your ‘SELECT’ statement.

[quote=16959:@Sean Clancy]My question is about sqlite dates.
From looking online, I notice sqlite date values are formatted YYYY-MM-DD
depending on the operating system format of the user’s country, the date in xojo will be a different format(like the UK or me (NZ))
[/quote]

An SQLDate will always be in YYYY-MM-DD no matter where you are from has nothing to do with xojo or sqlite or nationality.

Dim d As New Date

Dim s As string = d.slqdate //will always be in the format YYYY-MM-DD

//ergo when retrieving from the database

Dim d As New Date

d.SQLDate = rs.Field(“myDate”).getString //will always be correct.

Then like Mark points out let the database do the work

Great - thanks for the help…

Now - about d.day=d.day+10
does this change the the month to the next month… I mean it’ll be a bit of a bummer to have the 37th of february

will it work?

Yes, but you’re safer doing d.TotalSeconds = d.TotalSeconds + ( 10 * 24 * 60 * 60 )