Solved

Datetime changing

Posted on 2013-01-30
4
172 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 500 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

738 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