<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1021955" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1021955</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135830</link>
    <description> &lt;p&gt;i figured there had to be something easier... i store the utc offset in hours, so the page just needs to multiply that by 60*60 and add that to a utc timestamp....&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;# this is a test to get utc/gmt times&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$metime&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;M d Y H:i:s\&quot;, time());&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$gmttime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=gmdate(\&quot;M d Y H:i:s\&quot;, time());&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$gmttimestamp&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=time();&lt;br /&gt;&lt;br /&gt;echo &amp;lt;&amp;lt;&amp;lt;END&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;simple time test page&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;my time is: &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$metime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&lt;br /&gt;&amp;lt;br /&amp;gt;if this works right, this will be 4 or 5 hours ahead since &lt;br /&gt;it&#039;s&amp;lt;!--&#039;--&amp;gt; suppossed to be UTC/GMT time: &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$gmttime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&lt;br /&gt;&amp;lt;br /&amp;gt;gmt timestamp? &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$gmttimestamp&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;END;&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;does gmt time rather well.. so i&#039;ve got half a mind to move from a datetime to a string that&#039;s the utc timestampa char that size is what... 2 bytes? while i&#039;d need an int that&#039;s 4 bytes if i do it as a number...&lt;br /&gt;
in either case it&#039;s much cmaller than  an 8 byte datetime....i&#039;ll still use the 4byte timestamp for last_login_date since i want that to update automatically when i update the last_login_ip&lt;/p&gt;
 </description>
     <pubDate>Thu, 07 Aug 2003 17:36:10 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135830 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135647</link>
    <description> &lt;p&gt;yeah. that&#039;s what i meant, it uses the system time, so i can&#039;t use it as a gmt. i wanna calculate from that. i was hoping for something simple inside fo sql to do that (maybe i can suggest it for an update?)&lt;/p&gt;
&lt;p&gt;the only thing i could think of was using php&#039;s gmmktime() somehow.&lt;/p&gt;
&lt;p&gt;for some reason it suprises me there&#039;s not built in function&lt;/p&gt;
 </description>
     <pubDate>Tue, 05 Aug 2003 04:14:22 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135647 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135642</link>
    <description> &lt;p&gt;NOW() inserts the system time.  Be carefull how you word it.  I have a server in my house (Pacific),&lt;br /&gt;
as well as a server in Central, and Eastern.  The NOW() function returns the system time for each,&lt;br /&gt;
not the time in my timezone.&lt;/p&gt;
&lt;p&gt;I got this from the User Comments section of &lt;a href=&quot;http://www.mysql.com/doc/en/Date_and_time_functions.html&quot; class=&quot;bb-url&quot;&gt;6.3.4 Date and Time Functions&lt;/a&gt;:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT DATE_SUB(NOW(), INTERVAL TIME_TO_SEC(DATE_SUB(NOW(), INTERVAL UNIX_TIMESTAMP()-12*3600 SECOND))-12*3600 SECOND) AS GMT&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Tue, 05 Aug 2003 03:42:25 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135642 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135625</link>
    <description> &lt;p&gt;kewl.. umm.. NOW() gives MY date and time. is there a way to have it insert the date and time for UTC/GMT?&lt;/p&gt;
 </description>
     <pubDate>Mon, 04 Aug 2003 23:25:20 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135625 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135413</link>
    <description> &lt;p&gt;Yes. You can add columns to tables after creation.&lt;br /&gt;
ALTER table_name ADD column_name data_type_and_whatnot&lt;/p&gt;
 </description>
     <pubDate>Fri, 01 Aug 2003 07:34:23 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135413 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135407</link>
    <description> &lt;p&gt;i like that. i&#039;m still shuffling around a few feilds instead of making the db. &lt;/p&gt;
&lt;p&gt;i think we&#039;re close right now. there&#039;s three things i want for forums that i don&#039;t have anywhere and one of them could easily be put into the user stats where one other thing i want for the forums already is.&lt;/p&gt;
&lt;p&gt;the items and their functionality are&lt;br /&gt;
postcount -- to keep track of postcount even though i feel like displaying it could encourage &quot;postwhoring&quot;, i may want to display it in the future if the users want it (postranks would be calculated on the fly on that i guess)&lt;br /&gt;
affilliation -- this is in the stats right now, basically saying if the user donated to the site, or if i make a paid level down the road (something i&#039;m thinking fo doing) to denote those of that level&lt;br /&gt;
signature -- same thing as here. i&#039;d use a tinytext feild and limit it that way. odd note: i&#039;ve yet to see an asp based site with a signature and i&#039;ve yet to see a php based one without it. (personally i like it)&lt;br /&gt;
&quot;tagline&quot; -- since i&#039;m not going to have postranks and people like that, i figured this is something the mods and admins can set once we see what a user is like and have fun witht hem and give them something in it&#039;s place (personally i&#039;m also looking for a better name for it)&lt;/p&gt;
&lt;p&gt;i&#039;m thinking right now i should add them to the stats table and then call that from the forums to get them. i&#039;m wondering what the opinion of those that have more experience with this is.&lt;/p&gt;
&lt;p&gt;also, i know you can drop a column from a table and change the type of data in it (ie alter an int to a big int) but is there a way to add a column? the fact i don&#039;t know of one has had me hesitant to make the db until i&#039;m sure i have all the columns, especially when somethings are being tossed around so columns are being moved slightly etc.  on that note, if anyone with more experience would like to look over my current table set up and give me pointers to optimized the db, i would appreciate it. either message me or post here and let me know&lt;/p&gt;
 </description>
     <pubDate>Fri, 01 Aug 2003 03:33:56 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135407 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135405</link>
    <description> &lt;p&gt;No. MySQL will not allow the default value for columns to be a function.&lt;/p&gt;
&lt;p&gt;Yes. You can run an INSERT statement setting the datetime_field=NOW().&lt;/p&gt;
&lt;p&gt;As for the Who&#039;s Online...&lt;/p&gt;
&lt;p&gt;With your current DB table setup, I would just add a field to the user table called `last_activity`.  Whenever that user loads a page, or performs any other trackable action, set that fields value to NOW().&lt;/p&gt;
&lt;p&gt;To see who&#039;s online:&lt;br /&gt;
SELECT * FROM user_table WHERE last_activity&amp;gt;=DATE_SUB(NOW(), INTERVAL 5 MINUTE)&lt;/p&gt;
 </description>
     <pubDate>Fri, 01 Aug 2003 00:16:55 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135405 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/question-about-datetime#comment-1135389</link>
    <description> &lt;p&gt;let me add to this......&lt;/p&gt;
&lt;p&gt;ok. so i&#039;m making a rateme site. i think that&#039;s known.. well i wanna track who&#039;s actively online (like loaded a page in the last 5 min or such)&lt;/p&gt;
&lt;p&gt;would creating a table with the following and then setting 0 for offline and 1 for online and touching it (setting online to 1) with every pageload make sense in an optimally speacking way, or is there a better way (other tables i have are: users (the main table which is checked on any page that is restricted access as well as logging in since it stores the pws with an md5 mask on them... all cookies are currently plaintext with a check that the username an pw match what&#039;s on record AND the username has permission to access the page when going to a restricted page), stats (holds members stats), comments (holds comments on members), bio (holds member bios), interests (holds member&#039;s interests), friends (entries used to create a member&#039;s friends list), votes (tracks who you&#039;ve voted for.. will be manually reset once a month so that scores aren&#039;t changed by one person voting for him/herself 1000 times)):&lt;/p&gt;
&lt;p&gt;tracking who&#039;s online&lt;br /&gt;
CREATE TABLE online(&lt;br /&gt;
	username	varchar(15)	NOT NULL	PRIMARY KEY,&lt;br /&gt;
	last_page_load	timestamp,&lt;br /&gt;
	online	tinyint(1)	default &#039;0&#039;	NOT NULL	PRIMARY KEY&lt;br /&gt;
) TYPE=MyISAM;&lt;/p&gt;
&lt;p&gt;or is there something else that would be better to optimize this?&lt;/p&gt;
 </description>
     <pubDate>Thu, 31 Jul 2003 19:21:16 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135389 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
