• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Datetime changing

How do I get the current server datetime , add several hours and get it as datetime object?
0
yaron89
Asked:
yaron89
  • 2
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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
 
yaron89Author Commented:
I need to implement it to a datetime type for an sql table field
0
 
Dave BaldwinFixer of ProblemsCommented:
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
 
yaron89Author Commented:
$today
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now