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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:38:55+00:00 2026-05-22T22:38:55+00:00

I want to get the date with specific day and time in PHP, like

  • 0

I want to get the date with specific day and time in PHP, like i want the date of next day and time of 9.30 am i.e “2011-06-02 09:30:00”.
the code i was using get to do that,

<?php
   $next_day_date = date("Y")."-".date("m")."-".(date("d")+1)."  09:30:00";
   $new_trig_time_stamp = strtotime($next_day_date);
   $trigger_date_time = date("Y-m-d H:i:s",$new_trig_time_stamp);
   echo $trigger_date_time;
?>

the code above works fine but fails on 31 day, on 31st it returns “1970-01-01 05:30:00”.
Is there any other way to do so.

  • 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-22T22:38:55+00:00Added an answer on May 22, 2026 at 10:38 pm

    When shifting dates by a fixed number, it’s better to use mktime(), because it handles invalid dates well (e.g. it knows that January 32 is in fact February 1)

    $trigger_date_time = date("Y-m-d H:i:s", mktime(9,30,0, date('n'), date('j')+1, date('Y'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store the current date & time which can be get by
SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part:
I want to get one record before start date and end date DtpFrom means
I want to get the current UTC date with Javascript. How can I do
I have a table with an associate_id and date fields. I want to get
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
I want to add days to a date to get a new date in
I want get the time used for a case so I can create an
I want get all of the Geom objects that are related to a certain
I want to get started doing some game development using Microsoft's XNA. Part of

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.