Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

inserting current irish time in MYSQL

Options
  • 26-10-2005 10:53pm
    #1
    Registered Users Posts: 1,086 ✭✭✭


    I'm trying to update a field in my SQL table with the current time (IRELAND).

    I am using the statement:-

    $sql2= 'update login set lastloggedin = UTC_TIMESTAMP() where username = \''.$username.'\'';

    However the time is 1 hour too slow. Are we not Greenwich mean time or UTC?

    How can I modify this statement to insert Ireland's current time (which will include the hour changes in Spring and Autumn)?

    thanks in advance


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Peter B wrote:
    Are we not Greenwich mean time or UTC?

    Yes, and no. GMT/UTC is a static zone, it never changes. However, local time changes from UTC to BST (British Summer Time, or UTC+1) once a year, and back to it again later in the year. Technically, your code is correct, you just need ot make allowances for the time of the year.

    The definition of BST is as follows
    The Summer Time Act 1972 originally defined the period of British Summer Time to start at 2 am (GMT) on the morning of the day after the third Saturday in March or, if that was Easter Day, the day after the second Saturday. It was to end at 2 am (GMT) on the day after the fourth Saturday in October.
    Source: http://wwp.greenwichmeantime.com/info/bst.htm


  • Registered Users Posts: 1,086 ✭✭✭Peter B


    Thanks Aidan.

    Is there any mysql function to take into account of time changes? I was going to use the now() function only my server is in western United States I think.


Advertisement