Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jan 2010
    Posts
    18

    Default How to set correct field in my table for date?

    I have set PHP code like.
    PHP Code:
    date_default_timezone_set ("Europe/Berlin");
    echo 
    time();
    $cur_timestamp date("d-m-Y,H:i:s",time()); //26-01-2011,11:59:31
    echo $cur_timestamp
    Which type is correct to set date/time with URL like:
    MySQL :: MySQL 5.0 Reference Manual :: 10.3 Date and Time Types

    I have set wthin table:
    Type: TIMESTAMP
    What should be set for other fields?
    Last edited by toplisek; 01-26-2011 at 05:07 AM.

  2. #2
    Member coderiser's Avatar
    Join Date
    Jan 2011
    Posts
    18

    Default Re: How to set correct field in my table for date?

    I tend to store the timestamp as a int and then convert it using php on the display side.

    This can be useful as you can always modify your output and keep your timestamp with your data

  3. #3
    Member
    Join Date
    Jan 2010
    Posts
    18

    Default Re: How to set correct field in my table for date?

    Quote Originally Posted by coderiser View Post
    I tend to store the timestamp as a int and then convert it using php on the display side.
    Do you change manually local time or server time or you rather change INI specifications that server has local time?

  4. #4
    Member coderiser's Avatar
    Join Date
    Jan 2011
    Posts
    18

    Default Re: How to set correct field in my table for date?

    i found two ways to do this for users in different time zones.

    the 1st is to use a php function to adjust the time to 1 hour ago or 1 day ago as to not confuse the timezone and then simply display the date when posts exceed 1 year or so in time

    the 2nd way is to use javascript to detect the browser set timezone and then pass this as a variable to then auto adjust each output by whatever the timezone session variable is set at.

    I prefer the first way as I think it is more direct and more commonly used
    LicenseCube.com - Cheap Plesk, DirectAdmin, and WHMCS licenses with instant activation, full support, & free installation!

Similar Threads & Tags
Similar threads

  1. Replies: 1
    Last Post: 10-03-2008, 06:05 PM
  2. Correct Date and Time
    By DeadBeet in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 07-05-2007, 03:41 AM
  3. Why is a backslash added to Db field of db table of the mysql database of MySQL?
    By PondRicefied in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 09-14-2005, 01:49 PM
  4. CPanel Changing MYSQL table field properties
    By it-lighthouse in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-22-2005, 02:12 PM
  5. Horde - Date Field showing Time?
    By idn in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-25-2003, 07:32 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube