By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

Date in custom format

100+
P: 119
Hi,

I have to show system date in custom format

For example: 2009/Oct/06

I want to show date in above format. how to get this output .

i used the below format
Expand|Select|Wrap|Line Numbers
  1. $months = array(1 => "Jan", 2 => "Feb", 3 => "Mar", 4 => "Apr", 5 => "May", 6 => "Jun", 7 => "Jul", 8 => "Aug", 9 => "Sep", 10 => "Oct", 11 => "Nov", 12 => "Dec");
  2.  
  3. $raw_date = date("Y/m/d");
  4. list($year, $month, $day) = split('[/]', $raw_date);        
  5. $date = $year . "/" . $month . "/" . $day;
  6.  
But i struck how to apply that array format in this format?

Can any one help me how to get the custom format date using php.

Thanks in advance

Regards,
Oct 6 '09 #1
Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
what about
Expand|Select|Wrap|Line Numbers
  1. date("Y/M/d")
?
Oct 6 '09 #2

100+
P: 119
@Dormilich
in date("Y/M/d") function i am getting output as 2009/10/06.

but i want date in 2009/Oct/06. this format.

How to get this?

thanks in advance

Regards,
Oct 6 '09 #3

Dormilich
Expert Mod 5K+
P: 8,639
@phpmagesh
you probably wrote "Y/m/d" since "Y/M/d" resulted in the desired output (I tested that!)
Attached Images
File Type: jpg date.jpg (19.2 KB, 117 views)
Oct 6 '09 #4

Dormilich
Expert Mod 5K+
P: 8,639
@cestapassu
well, obviously. havenít you looked at date()ís formatting options? (thatís about three dozen letters)
Oct 6 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.