Note that there are some explanatory texts on larger screens.

plurals
  1. POCurrent DateTime is wrong using Strftime
    primarykey
    data
    text
    <p>In my android application, I use STRFTIME function to get data from SQLite by comparing different Date Strings. </p> <p>I set Promotion <code>StartDate</code> and <code>EndDate</code> to <code>2013-10-07</code> and <code>2013-12-31</code> respectively. Promotion exists when current DateTime is between <code>StartDate</code> and <code>EndDate</code>.</p> <p>The following is a complete list of valid strftime() substitutions:</p> <pre><code>%d day of month: 00 %f fractional seconds: SS.SSS %H hour: 00-24 %j day of year: 001-366 %J Julian day number %m month: 01-12 %M minute: 00-59 %s seconds since 1970-01-01 %S seconds: 00-59 %w day of week 0-6 with Sunday==0 %W week of year: 00-53 %Y year: 0000-9999= </code></pre> <p>And I use the following query to retrieve the data.</p> <pre><code>Select * From Sal_Promotion p, Sal_Promotion_CustomerTypeAndProduct pd Where p.Sal_PromotionID = d.Sal_PromotionID and strftime('%s','now') &gt;= strftime('%s',Sal_StartDate) and strftime('%s','now') = strftime('%s',Sal_EndDate) and Sal_CustomerTypeID = customerTypeID and p.Sal_PromotionID = promoID; </code></pre> <p>When I tested my application on 07 Oct 2013 morning 7 am, I get the following output.</p> <p><em><strong>Output:</em></strong> </p> <p>StartDate: 2013-10-07 00:00:00 (Value: 1381104000)</p> <p>EndDate: 2013-12-31 00:00:00 (Value: 1388448000)</p> <p>CurrentDateTime: 2013-10-07 07:00:00 (Value: 1381100400)</p> <p>CurrentDateTime value should be between StartDate and EndDate. But why the value is wrong? Current DateTime is 3600 seconds (1 hour) later than StartDate.</p> <p>My current city is Singapore (GMT+8:00). Is it because of time zone difference?</p> <p>Can someone point me out what is the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload