|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Mar 20, 2015 3:39 pm Post subject: |
|
|
How CURRENT_TIMESTAMP is stored is of no interest. You are not working with database files directly. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Mar 20, 2015 4:28 pm Post subject: |
|
|
Hey
I was discussing with sm@rty the 'modified' field definition we had used in our MYSQL cache resource in the demo folder where we used MSQL's 'CURRENT_TIMESTAMP' which is a string.
AnrDaemon wrote: | sm@rty wrote: | no problem in mysql.
Quote: |
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
CURRENT_TIMESTAMP is string date time. |
CURRENT_TIMESTAMP is a timestamp, not a string.
You can use it in any datetime context directly.
|
You brought up that it is not a string which, was a wrong statement.... |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Mar 20, 2015 10:39 pm Post subject: |
|
|
Judging from your code, you was doing it wrong all along, to begin with.
Retrieving a ready to use UNIX timestamp only to convert it back and forth, instead of comparing two timestamps directly, is. Just. Plain. Wrong. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Mar 21, 2015 4:38 am Post subject: |
|
|
AnrDaemon wrote: | Judging from your code, you was doing it wrong all along, to begin with.
Retrieving a ready to use UNIX timestamp only to convert it back and forth, instead of comparing two timestamps directly, is. Just. Plain. Wrong. |
Again wrong! Not converting it back and forth. MYSQL does update 'CURRENT_TIMESTAMP' internally on each record update so it's not depending on some timestamp you provide. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Mar 21, 2015 7:34 am Post subject: |
|
|
"Provide" what? You can compare it with timestamp from your template file. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Mar 21, 2015 8:58 am Post subject: |
|
|
AnrDaemon wrote: | "Provide" what? You can compare it with timestamp from your template file. |
If you update the template in the database you do not need to assign a timestamp value to the 'modified' field. MYSQL does fill it automatically (as string). |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|