• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Looking for help Storing/retriving dates in SQLite

New Here ,
Jun 02, 2014 Jun 02, 2014

Copy link to clipboard

Copied

Hi Guys,

I need to save and retrieve dates in a SQLite Database.

Im saving the dates lige this:

var mydate = "STRFTIME('%J','"+year+"-"+month+"-"+day+"')"

sqlquery("INSERT INTO gamedata ( leftTime, number, totalTime, usedTime, theDate)" + "VALUES ('"+setValueMaxSpendPerDay+"', '1', '"+setValueMaxSpendPerDay+"', '0', "+mydate+")");


Which seem to be working.

How ever when i need to select a specific date at a later stage im not having any luck 😕

Im trying this:

var day= "01";

var month= "06";

var year= "2014";

    var mydate = "STRFTIME('%J','"+year+"-"+month+"-"+day+"')"

  sqlquery("SELECT * FROM gamedata WHERE theDate == "+mydate);

I have also tried:

sqlquery("SELECT * FROM gamedata WHERE theDate == "+"'2014-06-01'");

But without any luck 😕

Any help is greatly appriciated.

Thanx in advance

Henry

TOPICS
Development

Views

185

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 02, 2014 Jun 02, 2014

Copy link to clipboard

Copied

LATEST

Have you tried inserting a Date object? I think it saves a timestamp in SQLite Date format.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines