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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:55:29+00:00 2026-06-13T01:55:29+00:00

i have question, i am using PHP script, there is something wrong when i

  • 0

i have question, i am using PHP script, there is something wrong when i add date to my database…

how can i fix/re-arrange this date

date( "Oct 18, 2012 05:06:42" );

my database accept only 2012-10-19 05:06:42

but i am receiving different form which is this Oct 18, 2012 05:06:42

here are my example code

$cocod = date( 'Oct 18, 2012 05:06:42' );//'Oct 18, 2012 2012-10-18';
$get = strtotime(date("Y-m-d H:m:s", strtotime($cocod)) . " +30 day");
$setex = date( 'Y-m-d H:m:s', $get );
echo $setex;

thank you…

  • 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-13T01:55:30+00:00Added an answer on June 13, 2026 at 1:55 am

    You can convert your formatted date back to a timestamp using the DateTime class

    $timestamp = DateTime::createFromFormat('M d, Y H:i:s', 'Oct 18, 2012 05:06:42')->getTimestamp();
    

    In your example above i can see you even wanted to add 30 days. You could do that like this:

    $date = DateTime::createFromFormat('M d, Y H:i:s', 'Oct 18, 2012 05:06:42');
    $date->add(new DateInterval('P30D'));
    

    If you now want to format your date again, do the following:

    $date->format('Y-m-d H:m:s');
    

    For further reading take a look at the DateTime class on php.net

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

Sidebar

Related Questions

I have a relatively simple question. Will using PHP guarantee that a form is
I have a question regarding using Semaphores HANDLE WINAPI CreateSemaphore(...); Is there anyway I
I have a basic PHP script like this: <?php system(/bin/touch /root/testfile); When I run
Is there a php equivalent to something like this jquery: var allInputs = $(:input);
I have a number of sites that are using this script for handling paypal
I have a question about using HTTPS in a JBossAS7 web application (a universal
i have a question about using GalleryView. At first, i set five default images
I have a question about using subqueries in an Update statement. My example: UPDATE
I have a question about using multiple .htaccess files - I couldn't find the
I have a question - I'm using CURL and PROXY. I'm getting list with

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.