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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:18:53+00:00 2026-05-28T07:18:53+00:00

I have an issue that I have been dealing for way to long Please

  • 0

I have an issue that I have been dealing for way to long

Please look at the code below: ( I have commented on the right the values that I get when I debug the variable)

When input is for example “0000-00-00 00:00:00”

 $date1 = ($date['confirmed_at']); //value of $date1 is "0000-00-00 00:00:00"
 $date2 = strtotime($date1); //value of $date2 is "1"
 $date3 = date('y-m-d',$date2); //value of $date3 is "70-01-01"

When input is for example “2011-09-12 08:57:26”

 $date1 = ($date['confirmed_at']); //value of $date1 is "2011-09-12 08:57:26"
 $date2 = strtotime($date1); //value of $date2 is "1315817846"
 $date3 = date('y-m-d',$date2); //value of $date3 is "11-09-12"

I’m a bit confused with the values that I have been getting…
All that I am trying to do is take the date which is currently in a “YYYY-MM-DD HH-MM-SS” and convert it into a “YYYY-MM-DD” format.

  • 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-28T07:18:54+00:00Added an answer on May 28, 2026 at 7:18 am

    What you’re seeing in the first example results from the fact, that strtotime() returns a unix timestamp, that is a number of seconds since Jan 1st, 1970. It just can’t return anything sensible for 0000-00-00 00:00:00.

    For YYYY-MM-DD format use date('Y-m-d')

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

Sidebar

Related Questions

I am having an issue with somethign that I thoguth woudl have been simple.
I have been having an issue with the $this->delete() method that deletes a record
I am relatively new to MYSQL and have had an issue that has been
I've got an issue that's been bothering me. I have to store information from
Can anyone advise on an issue that's been bugging me? I have a Java
I have an issue that's been bugging me this morning. I'm building an ASP.NET
Put it another way: what code have you written that cannot fail. I'm interested
I've been dealing with an issue for a while. The issue is that when
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that seems like very flaky behavour, is this a problem

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.