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

  • Home
  • SEARCH
  • 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 8251763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:20:38+00:00 2026-06-08T00:20:38+00:00

I have the date in is this format: June 22, 2012 Using PHP’s date

  • 0

I have the date in is this format:

June 22, 2012

Using PHP’s date function I am getting the date like so:

date("F j, Y")

Using an if statement I compare the two hoping to eliminate all of those dates which have already passed:

if(date("F j, Y") > $date)

However, it works but leaves all but one date:

February 14, 2012

Can someone explain why or tell me a better way to do this?

  • 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-08T00:20:40+00:00Added an answer on June 8, 2026 at 12:20 am

    date() returns a string, so in your case its only returns strings that are greater than the literal string “June 22, 2012”. Try using strtotime() on your date() call, e.g

    $today = strtotime($todays_date);
    

    This will take the time string returned by date() and convert it to unix timestamp, which you can use to compare dates.

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

Sidebar

Related Questions

I have a date in NSString format with this content: 29/02/2012 12:00:00 AM I'm
I have a date/time string like this: 180510_112440 in this format ddmmyy_hhmmss I need
I have a date field in the database table of this format 2012-02-1.i need
I have a date in this string format 02/28/2012 and I want to convert
I have date in this format (YYYYMM): 201201 // Gen, 2012 201202 // Feb,
I have Date in this format (2012-11-17T00:00:00.000-05:00). I need to convert the date into
I have a date format like this 2011-07-29T08:18:39 I want to convert this date
I have a data file with timestamps in this TEXT format: June 11, 2012
I have date time information in this format: String reportDate=2012-04-19 12:32:24; I want to
I have the need to display a date in this format: dd/mm/yyyy. This is

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.