?
Solved

Datetime changing

Posted on 2013-01-30
4
Medium Priority
?
174 Views
Last Modified: 2013-01-31
How do I get the current server datetime , add several hours and get it as datetime object?
0
Comment
Question by:yaron89
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38838725
PHP has datetime functions but not a datetime object.  Datetime values are normally stored in strings and converted as needed.  Here http://www.php.net/manual/en/function.date.php is info about the basic 'date' function and on the left are all the other date and time functions.
0
 

Author Comment

by:yaron89
ID: 38838747
I need to implement it to a datetime type for an sql table field
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 1500 total points
ID: 38838771
In the Example #4 date() Formatting section on that page:

$today = date("Y-m-d H:i:s");   // 2001-03-10 17:16:18 (the MySQL DATETIME format)

Open in new window

Conversion methods are also shown on that page.
0
 

Author Closing Comment

by:yaron89
ID: 38838803
$today
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question