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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:36:03+00:00 2026-05-17T15:36:03+00:00

Hallo, I am comparing 2 dates. It is clear that $db_minus7 is greater so

  • 0

Hallo,

I am comparing 2 dates. It is clear that $db_minus7 is greater so the value of $can_invoiced should be ‘maybe’ but it is ‘Yes’. When i execute.

<?php

$db_minus7 = '2010-07-05 09:45:29.420';
$completion_date = '30.07.2009';
if(date("m-d-Y",strtotime($db_minus7)) > date("m-d-Y",strtotime($completion_date))) {
    $can_invoiced = 'maybe';
} else {
    $can_invoiced = 'Yes';
}

echo $can_invoiced;

?>

please help

  • 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-17T15:36:03+00:00Added an answer on May 17, 2026 at 3:36 pm

    why don’t you just compare the times instad of formating them again like this:

    if(strtotime($db_minus7) > strtotime($completion_date)) {
        $can_invoiced = 'maybe';
    } else {
        $can_invoiced = 'Yes';
    }
    

    EDIT:

    if you want to use date(), use "Ymd" or "Y-m-d" as pattern because it’s string-comparision, and this is the logical order to work with (arrange the patterns from “big”(years) to small (days… or maybe seconds, if you need));

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

Sidebar

Related Questions

Hallo, i need to write some javascript that gets the contents of a userfield
hello i got a problem with comparing two char* variables that contains numbers for
Hello Everyone I want to execute an inline assembly instruction that is of the
Hello I am compiling a program with make but I get the error of
Hallo, i am using WSS 3.0 and i need to display certain entries of
Hallo i am currently playing around with castle projects ActiveRecord and the remoting facility.
I.e.: echo H#97llo | MagicPerlCommand Stdout: Hallo were MagicPerlCommand is something like perl -pnle
Hello everyone Masters Of Web Delevopment :) I have a piece of PHP script
This is an incredibly basic question, but how do I start a new CUDA
When comparing the performance of operations this is how I would typicaly do the

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.