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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:10:46+00:00 2026-05-16T14:10:46+00:00

I have a php script that runs on unix but I need it to

  • 0

I have a php script that runs on unix but I need it to run on windows.

setTimestamp is unix only and I need the windows equivalent.

http://php.net/manual/en/datetime.settimestamp.php

Example:

foreach($config['feeds'] as $feed){
    // in case we didn't save a last checked date, set it to sometime in the 70's
    $last_date = new DateTime();
    $last_date->setTimestamp(0);
    $last_date_save = 0;
    // the feeds are identified in the cache file by the hash of their url.
    $feed_hash = sha1($feed['url']);

    if(isset($stats[$feed_hash]['lastPubDate'])){
        if($config['debug'] > 0) echo "feed had lastpubdate\n";
        $last_date = new DateTime();
        $last_date->setTimestamp($stats[$feed_hash]['lastPubDate']);
    }

}

Any ideas?

  • 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-16T14:10:46+00:00Added an answer on May 16, 2026 at 2:10 pm

    Myth:

    settimestamp is NOT Unix-Only.

    Real Reason:

    The reason it is not working is because its availability is (PHP 5 >= 5.3.0) and your Windows machine may have an older version of PHP installed.

    Solution:

    1. Insall latest PHP. OR:
    2. You can use the constructor of the class which is available (PHP 5 >= 5.2.0) like this:

      $last_date = new DateTime('@0'); // change construction line like this
      //$last_date->setTimestamp(0); // <-- remove this line

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

Sidebar

Related Questions

I have a php script that is run once a minute. The script runs
i have a php script that runs perfectly but i get 2 errors: Warning:
I have a PHP script that runs as a CGI program and the HTTP
I have a php script that runs a mysql query, then loops the result,
I have a command-line PHP script that runs a wget request using each member
I have a PHP script that very much like a commenting system, but requires
I have a PHP script that runs a SELECT query then immediately deletes the
I have a PHP script that runs on cron that can take up to
I have a php script that runs some checks, if the checks fail it
I have a script that runs every hour on my php site. In that

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.