DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Date Time Format In RUBY

07.07.2006
| 390750 views |
  • submit to reddit
        ------------------------------------------------------------------- Time#strftime
time.strftime( string ) => string
---------------------------------------------------------------------------------
Formats time according to the directives in the given format string. Any text not listed as a directive will be passed through to the output string.

"
Format meaning:

  %a - The abbreviated weekday name (``Sun'')
  %A - The  full  weekday  name (``Sunday'')
  %b - The abbreviated month name (``Jan'')
  %B - The  full  month  name (``January'')
  %c - The preferred local date and time representation
  %d - Day of the month (01..31)
  %H - Hour of the day, 24-hour clock (00..23)
  %I - Hour of the day, 12-hour clock (01..12)
  %j - Day of the year (001..366)
  %m - Month of the year (01..12)
  %M - Minute of the hour (00..59)
  %p - Meridian indicator (``AM''  or  ``PM'')
  %S - Second of the minute (00..60)
  %U - Week  number  of the current year,
          starting with the first Sunday as the first
          day of the first week (00..53)
  %W - Week  number  of the current year,
          starting with the first Monday as the first
          day of the first week (00..53)
  %w - Day of the week (Sunday is 0, 0..6)
  %x - Preferred representation for the date alone, no time
  %X - Preferred representation for the time alone, no date
  %y - Year without a century (00..99)
  %Y - Year with century
  %Z - Time zone name
  %% - Literal ``%'' character

   t = Time.now
   t.strftime("Printed on %m/%d/%Y")   #=> "Printed on 04/09/2003"
   t.strftime("at %I:%M%p")            #=> "at 08:56AM"
"
    

Comments

Jak Down replied on Fri, 2014/11/28 - 11:01am

I'm impressed, I must say. Very rarely do I come across a blog that's both informative and entertaining, and let me tell you, you've hit the nail on the head. Your blog is important; the issue is something that not enough people are talking intelligently about. cafepress coupon code december 2014

Jak Down replied on Tue, 2014/11/25 - 9:48am

 That's what makes you the best. You should keep publishing more articles and you will Such Become One of the best writers ever nordstrom promo code december 2014

Pariyah Pariasid replied on Tue, 2014/11/25 - 5:05am

I am a racing fan and I always keep an eye on Igls racing. Your blog is excellent in bringing the latest updates on Igls racing. Keep posting more updates and latest news on this and I will recommend this website to all Igls racing fans.  google play gift card free 

Jak Down replied on Mon, 2014/11/24 - 12:29pm

This is exactly what I was looking for. Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this! rebelmouse.com

Jam Herry replied on Mon, 2014/11/24 - 8:30am

 Well I haven’t seen a good post like this in a year now. And seeing this post now, ahh, it really pleasures me. Thanks a lot for this post.

Solicitors Accident Claims

Base Ment replied on Sat, 2014/11/22 - 1:11pm

t is our good luck that I found this meaning ful article to study because there is a lots of topics to study what can increase our social sites knowledge  gmdplus"


Jak Down replied on Fri, 2014/11/21 - 7:34am

Thank you for the sensible critique. Me & my neighbour were preparing to do some research about that. We got a good book on that matter from our local library and most books where not as influensive as your information Denali Executives Inc

Jak Down replied on Fri, 2014/11/21 - 5:58am

similar topics. i see you got really very useful topics , i will be always checking your blog thanks. veritas inc reviews

Jak Down replied on Thu, 2014/11/20 - 11:58am

Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates. http://www.free-karaoke-online.com/text.php?lang=heb&id=4&sid=24

Jak Down replied on Thu, 2014/11/20 - 7:47am

 This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck. www.rebelmouse.com/fibroids_miracle

Jak Down replied on Sat, 2014/11/15 - 12:24pm

Your good knowledge and kindness in playing with all the pieces was very useful. I don’t know what I would have done if I had not encountered such a step like this Bryllupsfest Kjoler

Jak Down replied on Fri, 2014/11/14 - 8:52am

Well Smile I love reading and I am always searching for informative infoasdadrmation like this. This is exactly what I was looking.home remedies to get pregnant easier

Jak Down replied on Tue, 2014/11/11 - 7:29am

 I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. haarfarbe

Jak Down replied on Sun, 2014/11/09 - 8:31am

 Your good knowledge and kindness in playing with all the pieces was very useful. I don’t know what I would have done if I had not encountered such a step like this cheap twitter tweets

Jak Down replied on Sat, 2014/11/08 - 2:14pm

 I love the humor your post has offered. I enjoyed this site a lot. Keep posting article like this. It is fun. Nice photography too! can you ever get rid of type 2 diabetes

Jak Down replied on Thu, 2014/11/06 - 2:03pm

 The matter you've highlighted above is surely valueable for anyone to workout. the concept of your article is very true and It will result in a positive way. ponny

Jak Down replied on Thu, 2014/11/06 - 12:40pm

 I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work. spliss

Jak Down replied on Thu, 2014/11/06 - 7:46am

 I simply wanted to write down a quick word in order to say thanks to you for those wonderful tips and hints you are showing on this site. koffergröße

Jak Down replied on Thu, 2014/11/06 - 6:35am

 I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work. erfahrungen

Jak Down replied on Sun, 2014/11/02 - 6:10am

 Hello! I just wish to give an enormous thumbs up for the nice info you've got right here on this post. I will probably be coming back to your weblog for more soon read more on virtual office benefits

Jak Down replied on Fri, 2014/10/31 - 7:44am

 There are many people who desire to build muscles on their bodies. You might be one of them and you are probably wondering why your daily workout is not effective. cake stencil

Zoltan Zarka replied on Wed, 2014/10/29 - 5:46pm

Email marketing has proved to be one of the most effective digital promotion techniques, with its capacity to reach a vast audience very quickly and at the lowest cost. That is why it's important not to underestimate the technical aspects of email delivery.  Now common email providers like Yahoo! Mail or Gmail do not allow you to send unlimited emails at once: they  have some strict limitations both for the number of messages and the number recipients you can handle per day.www.unlimitedsmtp.biz 

Zoltan Zarka replied on Wed, 2014/10/29 - 5:45pm

Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.www.cheapsmtp.info 

Jak Down replied on Wed, 2014/10/29 - 2:16pm

 Hello! I just wish to give an enormous thumbs up for the nice info you've got right here on this post. I will probably be coming back to your weblog for more soon foods to conceive a baby boy naturally

Jak Down replied on Wed, 2014/10/29 - 12:02pm

 There are many people who desire to build muscles on their bodies. You might be one of them and you are probably wondering why your daily workout is not effective. hyppagu insurance

Jak Down replied on Wed, 2014/10/29 - 10:25am

 This is exactly what I was looking for. Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this! being with a guy who won't commit

Jak Down replied on Wed, 2014/10/29 - 6:44am

 I ‘d mention that most of us visitors are really endowed to exist in a fabulous place with very many wonderful individuals with very helpful things. f4x book

Jak Down replied on Tue, 2014/10/28 - 7:44am

 There are many people who desire to build muscles on their bodies. You might be one of them and you are probably wondering why your daily workout is not effective. Attorneys In Columbus Georgia

Jak Down replied on Tue, 2014/10/28 - 4:24am

 
There are many people who desire to build muscles on their bodies. You might be one of them and you are probably wondering why your daily workout is not effective. ets 2 mods

Jak Down replied on Tue, 2014/10/28 - 3:31am

 
This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck. kyle leon's adonis golden ratio reviews

Jak Down replied on Sun, 2014/10/26 - 3:56am

 Your good knowledge and kindness in playing with all the pieces was very useful. I don’t know what I would have done if I had not encountered such a step like this immigration laws

Jak Down replied on Sat, 2014/10/25 - 10:48am

 I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work. bakterien

Jak Down replied on Sat, 2014/10/25 - 7:21am

 All the contents you mentioned in is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks sieb

Jak Down replied on Fri, 2014/10/24 - 6:04am

 There are many people who desire to build muscles on their bodies. You might be one of them and you are probably wondering why your daily workout is not effective rebelmouse.com

Jak Down replied on Thu, 2014/10/23 - 6:16am

 I have browsed most of your posts. This post is probably where I got the most useful information for my research loyal 9 marketing scam

Jak Down replied on Thu, 2014/10/23 - 4:43am

 Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. loyal 9 marketing reviews

Jak Down replied on Thu, 2014/10/23 - 3:28am

 We are an Internet Marketing and Management company Specializing in Search Engine Optimization, Website Design and Social Media Campaign Development. loyal 9 reviews

Abdel Zoo replied on Wed, 2014/10/22 - 8:04pm

  Thanks for your efforts  g9g 2014 games

Jak Down replied on Tue, 2014/10/21 - 7:46am

 
There are many people who desire to build muscles on their bodies. You might be one of them and you are probably wondering why your daily workout is not effective click

cris ma replied on Tue, 2014/06/10 - 2:01pm

 LED lights nowadays are a matter of great deal of thought for practicality reason. Electric companies are charging more and one thing is sure, they will continue to raise the rate.

LED Lights For Home

Alex Jee replied on Tue, 2014/05/13 - 11:55am in response to: Ahsan Gill

A great website accompanying fascinating also lone stuff what more would you demand.http://www.wmaker.net/regarder-film/ 

Alex Jee replied on Mon, 2014/02/24 - 1:06pm in response to: Ahsan Gill

I visualize the greatest texts on your blog further I certainly affection lesson them.
Transporting a horse 

Ahsan Gill replied on Tue, 2014/02/04 - 3:02pm

Wow! I really appreciate the thought that you put into this article. This topic has been something I have been looking into for a few hours and your post is one of the best I have read. bodyguar services in rio de jeneiro bodyguard services in sao paulo bodyguard services in sochi bodyguard services in russia

Engr Ubaid Masood replied on Mon, 2014/02/03 - 2:21am

Hi,

This is great informative and helpful blog , thanks for sharing

Regards,

 

Construction Site in London 

hire domestic workers in london 

Hire security in london 

www.ibodyguardlondon.com

Alex Jee replied on Sat, 2014/03/01 - 2:05pm in response to: Ahsan Gill

Your blogs furthermore entire split matter are so interesting besides moneymaking it prepares me happen retreat most afresh.
solda mig usada 

Ankur Sharma replied on Wed, 2013/11/20 - 2:58am

LED Bulbs
The energy efficient nature of LEDs allows them to produce brighter light than other types of www.myledlight.co.uk bulbs while using less energy.

Ankur Sharma replied on Wed, 2013/11/13 - 6:16am

 Design is the fundamental soul of a man-made creation that ends up expressing itself in successive outer layers of the product or service. The iMac is not just the color or translucence or the shape of the shell. Energy

Ankur Sharma replied on Fri, 2013/10/18 - 5:49am

 seo group of jhansi, social media optimization, link building,social bookmarking,article submission services,<a href="http://onlineseojhansi.blogspot.in/">best services in jhansi</a>online seo in jhansi,link building services,best services in jhansi
<a href="http://seogroupofjhansi.blogspot.in/">Link building</a>