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

  • Home
  • SEARCH
  • 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 520175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:07:04+00:00 2026-05-13T08:07:04+00:00

Question 1) Assuming a user has a timezone setting saved as ‘America/New_York’ in my

  • 0

Question 1)
Assuming a user has a timezone setting saved as ‘America/New_York’ in my application, would I just use this on a page where I need to
show the correct time with timezone offset and daylight savings applied

<?php
$time_zone = 'America/New_York';
date_default_timezone_set($time_zone);
echo date('D,F j, Y, h:i:s A');
?>

OR should I use something more like this approach
When I query my data I use the following PHP script

<?PHP
while($row = mysql_fetch_array($registration)){ 

$dt_obj = new DateTime($row['message_sent_timestamp']." UTC");
$dt_obj->setTimezone(new DateTimeZone('America/New_York'));
echo $formatted_date_long=date_format($dt_obj, 'Y-m-d H:i:s'); }
?>
  • 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-05-13T08:07:04+00:00Added an answer on May 13, 2026 at 8:07 am

    I prefer to explicitly format dates according to user preferences on output, rather than set a default timezone for the entire executing script. That makes it easier to work with dates in, say, UTC by default, for actions such as saving data or calculating elapsed times.

    You can easily write a date formatting function/method that takes into account user timezone. I usually load the user timezone once, then on each subsequent date formatting call, access the cached timezone. This quick method prevents me from inadvertently using or saving data in the wrong timezone format.

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

Sidebar

Related Questions

my question is: assuming we have a calendar_table with UNIX datestamp date_column, i want
This is a pretty simple question and I'm assuming the answer is It doesn't
alt text http://img517.imageshack.us/img517/8124/56267347.jpg Assuming i have a winform that has a button called Create
My idea: I have a database of users, each user has an autoincremented id
This question has been asked in various permutations, but I haven't found the right
Assuming I have a project that is: using UINavigationController that has the (a) main
A user of my program has reported problems reading a settings file written by
I think these are pretty close to being non-coding question, but it has everything
There are several packages in my application that user can select each one according
Each article of my site has a unique ID number. When a user clicks

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.