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 7061451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:28:33+00:00 2026-05-28T04:28:33+00:00

My time zone is Europe/Rome . I’m using Facebook PHP SDK and insights part

  • 0

My time zone is Europe/Rome. I’m using Facebook PHP SDK and insights part of the API accepts a parameter end_time relative to Pacific Daylight Time:

The end of the period during which the metrics were collected,
expressed as a unix time (which should always be midnight, Pacific
Daylight Time).

Question is fair simple: should i convert $end to PDT (and how) before calling getTimeStamp() in order to get correct stats for my time zone?

// Get stats with 1st January 2012 as end_time (relative to my time zone)
$page  = Facebook->getUser()->getPage($id);
$stats = $page->getData('page_views_unique', new DateTime('2012-01-01')); 

public function getData($metric, DateTime $end = null)
{
   $now = new DateTime();
   $end = is_null($end) || $end > $now ? $now : $end; // Default is $now

   // API call
   $args = array('end_time' => $end->getTimestamp());
   $this->sdk->api(sprintf('/%s/insight/%s', $this->id, $metric), 'GET', $args);
}
  • 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-28T04:28:34+00:00Added an answer on May 28, 2026 at 4:28 am

    Convert time and date from one time zone to another in PHP

    <?php
    $date = new DateTime('2000-01-01', new DateTimeZone('Europe/Rome'));
    echo $date->format('Y-m-d H:i:sP') . "\n";
    
    $date->setTimezone(new DateTimeZone('America/Los_Angeles'));
    echo $date->format('Y-m-d H:i:sP') . "\n";
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example, I have time zone is : Europe/London or America/Los_Angeles In Perl, I can
Working to get DateTimes for any time zone. I'm using DateTimeOffset, and a string,
Regardless of what the user's local time zone is set to, using C# (.NET
I'm parsing timestamps. They are forced to my local time zone (Europe/London) when I
PHP date() & time() return incorrect time: When date.timezone = Europe/Riga the time returned
Joda doesn't allow to create an instance of DateTime in Europe/Moscow time zone pointed
My time zone is CET (Berlin). And while testing Joda's DateTime i noticed some
I have all the time zone information that is needed and it saves all
How do you set the Windows time zone on the local machine programmatically in
How can I gather the visitor's time zone information? I need both: the time

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.