datetime start of day result

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

datetime start of day result

jose isaias cabrera

Greetings!

if I run this command on the sqlite3 command tool,

select datetime('now','localtime');

I get,

sqlite> select datetime('now','localtime');
2015-07-29 00:48:07

which is correct.  When I run this command,

sqlite> select datetime('now','start of day','localtime');
2015-07-28 20:00:00

I am expecting 2015-07-29 00:00:00.  What does 'start of day' does/means?
Thanks.

josé

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: datetime start of day result

Rafał Ponikwia
On 2015-07-29 07:03, jose isaias cabrera wrote:
> sqlite> select datetime('now','start of day','localtime');
> 2015-07-28 20:00:00

I think, in your case in first resets hours for UTC time, and then
changes to your local time.
Try to change order of arguments (this should first change date to you
local time, and then set hours to 0):
sqlite> select datetime('now','localtime','start of day');

Regards,
RP.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: datetime start of day result

Hick Gunter
In reply to this post by jose isaias cabrera
You are converting the "start of day" (UTC) to "localtime". Your timezone is obviously 4 hours behind UTC...

asql> SELECT datetime('now'), datetime('now','localtime'),datetime('now','start of day'),datetime('now','localtime','start of day'),datetime('now','start of day','localtime');
                           datetime('now') = 2015-07-29 06:28:59
               datetime('now','localtime') = 2015-07-29 08:28:59
            datetime('now','start of day') = 2015-07-29 00:00:00
datetime('now','localtime','start of day') = 2015-07-29 00:00:00
datetime('now','start of day','localtime') = 2015-07-29 02:00:00

-----Ursprüngliche Nachricht-----
Von: jose isaias cabrera [mailto:[hidden email]]
Gesendet: Mittwoch, 29. Juli 2015 07:04
An: [hidden email]
Betreff: [sqlite] datetime start of day result


Greetings!

if I run this command on the sqlite3 command tool,

select datetime('now','localtime');

I get,

sqlite> select datetime('now','localtime');
2015-07-29 00:48:07

which is correct.  When I run this command,

sqlite> select datetime('now','start of day','localtime');
2015-07-28 20:00:00

I am expecting 2015-07-29 00:00:00.  What does 'start of day' does/means?
Thanks.

josé

_______________________________________________
sqlite-users mailing list
[hidden email]<mailto:[hidden email]>
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: [hidden email]

This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: datetime start of day result

jose isaias cabrera
In reply to this post by Rafał Ponikwia

"Rafal Ponikwia" wrote...

> On 2015-07-29 07:03, jose isaias cabrera wrote:
>> sqlite> select datetime('now','start of day','localtime');
>> 2015-07-28 20:00:00
>
> I think, in your case in first resets hours for UTC time, and then
> changes to your local time.
> Try to change order of arguments (this should first change date to you
> local time, and then set hours to 0):
> sqlite> select datetime('now','localtime','start of day');

DUH!  Thanks.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: datetime start of day result

jose isaias cabrera
In reply to this post by Hick Gunter

"Hick Gunter" wrote...

> You are converting the "start of day" (UTC) to "localtime". Your timezone
> is obviously 4 hours behind UTC...
>
> asql> SELECT datetime('now'),
> datetime('now','localtime'),datetime('now','start of
> day'),datetime('now','localtime','start of day'),datetime('now','start of
> day','localtime');
>                           datetime('now') = 2015-07-29 06:28:59
>               datetime('now','localtime') = 2015-07-29 08:28:59
>            datetime('now','start of day') = 2015-07-29 00:00:00
> datetime('now','localtime','start of day') = 2015-07-29 00:00:00
> datetime('now','start of day','localtime') = 2015-07-29 02:00:00

Thanks.  These examples should be part of the documentation. ;-)  I went to
the documentation and browse through it without getting deep into it.
Thanks again.

josé

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users