[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

PHP date time formating

Posted on 2011-02-25
6
Medium Priority
?
382 Views
Last Modified: 2012-05-11
How do I format date/time to 20110224T090000 format?
I looked up PHP date functions but most of the examples were for current date only.

Let's see I have a variable $start_date

The date that I have in Oracle database is: 4/14/2011 10:00:00 AM

How do I format this in PHP that it gives me 20110414T100000

Thanks much.
0
Comment
Question by:awarraic
[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
  • 3
  • 3
6 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 34979726
use date("Ymd\THis", $start_date)
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 34979756
note that the date function assumes $start_date is in timestamp format. You can do that via oracle, or you can parse it with

echo date("Ymd\THis", strtotime($start_date));

0
 

Author Comment

by:awarraic
ID: 34979928
it shows some default date:
19700101T000003

Do I need to set some default date format or something?
Thanks.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:awarraic
ID: 34979972
It worked, just missed strtotime(). thanks much.
0
 
LVL 24

Accepted Solution

by:
mankowitz earned 2000 total points
ID: 34980629
but i did answer.
0
 

Author Comment

by:awarraic
ID: 34981547
Sorry somehow the points thing didn't work.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

649 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