Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. I have a problem now

I have a problem now

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpdatabasequestionsysadmin
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arunkumar Koloth
    wrote on last edited by
    #1

    Hi I have a problem now in my sql query iam using

    NOW()

    To Insert My Current Date and time when i do this i can't get my country date and time. how can i change this to my local time? i Used

    date();

    Function Also But The Date is shown here wrong!. i thing the date is showing here is my server date and server time! Anyone please tel me how can i fix this problem? Please Help Me To Do this :(( :(( :(( Arunkumar.T

    Arunkumar.T

    P Y A 3 Replies Last reply
    0
    • A Arunkumar Koloth

      Hi I have a problem now in my sql query iam using

      NOW()

      To Insert My Current Date and time when i do this i can't get my country date and time. how can i change this to my local time? i Used

      date();

      Function Also But The Date is shown here wrong!. i thing the date is showing here is my server date and server time! Anyone please tel me how can i fix this problem? Please Help Me To Do this :(( :(( :(( Arunkumar.T

      Arunkumar.T

      P Offline
      P Offline
      Peter_in_2780
      wrote on last edited by
      #2

      Use date-default-timezone-set()[^] early in your PHP. That will set PHP time correctly. I don't know how you would set the SQL server time - maybe it has a similar function. Peter

      Software rusts. Simon Stephenson, ca 1994.

      C 1 Reply Last reply
      0
      • P Peter_in_2780

        Use date-default-timezone-set()[^] early in your PHP. That will set PHP time correctly. I don't know how you would set the SQL server time - maybe it has a similar function. Peter

        Software rusts. Simon Stephenson, ca 1994.

        C Offline
        C Offline
        cjoki
        wrote on last edited by
        #3

        http://www.electrictoolbox.com/mysql-set-timezone-per-connection/[^]

        Chris J www.redash.org

        P 1 Reply Last reply
        0
        • C cjoki

          http://www.electrictoolbox.com/mysql-set-timezone-per-connection/[^]

          Chris J www.redash.org

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          Thanks. I was pretty sure that it should exist, but didn't know the details (and, to be honest, didn't have the energy to google it). I'm familiar with the PHP one because I work with Apache servers running on 3 different timezones that should all appear to be local. Cheers, Peter

          Software rusts. Simon Stephenson, ca 1994.

          1 Reply Last reply
          0
          • A Arunkumar Koloth

            Hi I have a problem now in my sql query iam using

            NOW()

            To Insert My Current Date and time when i do this i can't get my country date and time. how can i change this to my local time? i Used

            date();

            Function Also But The Date is shown here wrong!. i thing the date is showing here is my server date and server time! Anyone please tel me how can i fix this problem? Please Help Me To Do this :(( :(( :(( Arunkumar.T

            Arunkumar.T

            Y Offline
            Y Offline
            yiday
            wrote on last edited by
            #5

            You can use php timestamp

            1 Reply Last reply
            0
            • A Arunkumar Koloth

              Hi I have a problem now in my sql query iam using

              NOW()

              To Insert My Current Date and time when i do this i can't get my country date and time. how can i change this to my local time? i Used

              date();

              Function Also But The Date is shown here wrong!. i thing the date is showing here is my server date and server time! Anyone please tel me how can i fix this problem? Please Help Me To Do this :(( :(( :(( Arunkumar.T

              Arunkumar.T

              A Offline
              A Offline
              arya1685
              wrote on last edited by
              #6

              Hi, You can set the default time zone by using

              date_default_timezone_set()

              or by

              string date ( string $format [, int $timestamp = time() ] )

              for more details please see http://php.net/manual/en/function.date.php[^]

              Thanks & Regards

              Arya1685

              “You are not only responsible for what you say, but also for what you do not say”

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups