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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:16:38+00:00 2026-05-21T05:16:38+00:00

I am running a service hosted on a server in the US which reads

  • 0

I am running a service hosted on a server in the US which reads an XML feed that has been created with a local date – currently just the UK, but I want to ensure the service works with all timezones.
My process looks at the date of a post in a feed and compares it with the date/time right now(on the server in the US).
The solution I came up with localises the system to the originator of the feed and then creates a timestamp with which to compare ‘now’ with:

protected function datemath($thedate){

    $currenttimezone = date_default_timezone_get();
    date_default_timezone_set($this->feedtimezone);
    $thedate = mktime substr($thedate,11,2),substr($thedate,14,2),
    substr($thedate,17,2),substr($thedate,3,2),substr($thedate,0,2),
    substr($thedate,6,4));
    date_default_timezone_set($currenttimezone);
    return $thedate;

    }

My question is this… Is this a reasonable way of handling this issue or is there a better, more standardized way that I really should know?

  • 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-21T05:16:38+00:00Added an answer on May 21, 2026 at 5:16 am

    After a bit more checking of other peoples code I see the function

    strtotime($thedate);
    

    is a little bit more succinct than using mktime and also allows for different time formats.

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

Sidebar

Related Questions

Let's say I'm running a hosted service that wishes to allow plugins written by
I have a wcf application hosted in a windows service running a local windows
I have a WCF service hosted at local IIS. I created a ASP.NET website
Im building a WPF 3.5 desktop app that has a self-hosted WCF service. The
I have a windows service running. Within it the task runs currently at 7pm
I have a website hosted on my web server contacting a secure web service
When trying to make a web service (hosted on a different server) call from
I've got a GUI client which is running against a WCF services hosted as
I am working on a website hosted on microsoft's office live service. It has
I'm working with two applications, one has a self hosted service configured to use

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.