Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8263825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:14:07+00:00 2026-06-08T04:14:07+00:00

How to get the local date and time in PHP.For example my timezone is

  • 0

How to get the local date and time in PHP.For example my timezone is Asia/Kolkata.
My application has to add the date in my time zone to the database.I know the time can be found by adding 5.30 hrs to UTC time.But what about the date.After some googling I found that there is a DateTime object and it has a function setTimezone() to set the time zone.But after setting how can i get the current date in my time zone.?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:14:08+00:00Added an answer on June 8, 2026 at 4:14 am

    The localtime() function returns you all the data of the local time of the server. It has a lot of options so you can get it in different types of array (associative or numerically indexed). You can use also date() that use the local timezone of the server, too. You can change the timezone of the server with the date_default_timezone_set() function.


    Learn more about the localtime() function and its parameters: http://php.net/manual/en/function.localtime.php or http://www.w3schools.com/php/func_date_localtime.asp

    Learn more about the date() function and its parameters: http://php.net/manual/en/function.date.php

    Learn more about the date_default_timezone_set() function and its parameters: http://www.php.net/manual/en/function.date-default-timezone-set.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know know how to programatically get the local date and time of
I would like a simple way to get yesterday's date (local time) as a
I want to be able to get the local date and time for wherever
I am trying the get the user’s local time to store into my database.
I have this code to get the local date/time. It works but it seems
I'm looking for a good way to get the local application data folder for
With Datomic, I am confused as to how to get a local database to
I have a php page which has a chart, a date picker(calendar) and a
I have a string containing a local date/time and I need to convert it
It appears there are many ways to approach date and time massaging in php.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.