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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:55:14+00:00 2026-06-01T06:55:14+00:00

Yesterday I asked another question to calculate time. Now I realized, that it makes

  • 0

Yesterday I asked another question to calculate time.

Now I realized, that it makes no sense to use a second table for my project because everything that is necessary is already given in my first table. So, for the moment I use two tables where I insert two timestamps:

$time = "INSERT INTO table2 ( a, b, c) VALUES (NOW(),NOW() + INTERVAL 14 DAY,(unix_timestamp(NOW()+ INTERVAL 14 DAY)) - unix_timestamp(NOW()))";

Like I already said, it could be much easier and the same result will be reached without a second table. Now my problem is, this is the first time I have worked with timefunctions in php. There are a lot of different functions that I do not really understand.

I think to solve my problem I can use something like:

$row = fetch_assoc()
$old_timestamp = $row->b;

$actual_time = mktime(); //which makes an actual timestamp
$seconds = '1209600'; //which is exactly the timeperiod of 14 days
$added = $old_timestamp + $seconds; //which adds the seconds to the old timestamp and should be the same as NOW() + INTERVAL 14 DAY from the VALUE of the query
$date_to_check = $added - $actual_time;
   if $date_to_check <= 0 { 
     do something }

Is this possible? I would really appreciate if there is someone who can help. thanks a lot.

UPDATE

For everyone who likes to know what i have in mind. Here is the code for the actual way:

$time_check = $db->query("SELECT (B <= NOW()) AS var FROM table2 WHERE x='$x'");         
            while ($row = $time_check->fetch_object()){ 
                if (($row->var != 0) && ($var1 === '0')){
                        $update_status = $db->query("UPDATE table1 SET var1='1' WHERE x='$x'");{
                            $delete_timecount = $db->query("DELETE FROM table2 WHERE x='$x'");
                        }
                }
            }

I would like to accomplish the same result without a second table.

  • 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-01T06:55:16+00:00Added an answer on June 1, 2026 at 6:55 am

    I can’t really understand what you are trying to do. It appears that you are trying to recognize when 14 days have elapsed after someone’s registration in order to do something.

    if (time() > $old_timestamp + 1209600) {
        // It's been 14 days
        // Do something
    }
    

    I used time, which simply returns the current time. Do you understand what a timestamp is?

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

Sidebar

Related Questions

This problem is related to This question I asked yesterday. Now it seems that
I already asked a question about this yesterday, but now I have another :)
This question is related to another question which I asked yesterday! List all links
One of the responses to a question I asked yesterday suggested that I should
This one is similar to a question that I asked yesterday. However my concern
I asked a question yesterday about a problem that Im having with a program
While looking at a micro-optimization question that I asked yesterday ( here ), I
Yesterday i asked this question: Get current time and set a value in a
I asked yesterday a question about css div positioning, now I solved my issue
Relating to another question I asked yesterday with regards to logging I was introduced

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.