RFC1123 Dates and Times
From Erlang Community
(Difference between revisions)
| Revision as of 00:11, 4 September 2006 (edit) Bfulgham (Talk | contribs) ← Previous diff |
Revision as of 16:43, 3 December 2006 (edit) (undo) Kaiserpanda (Talk | contribs) m Next diff → |
||
| Line 32: | Line 32: | ||
| [[Category:CookBook]][[Category:DateTimeRecipes]] | [[Category:CookBook]][[Category:DateTimeRecipes]] | ||
| + | |||
| + | |||
| + | |||
| + | [http://www.3wcasinos.com/roulette-tips/index.html roulette tips] | ||
| + | [http://www.gambling-online-theory.com/casinos/fun-casinos.html fun casinos] | ||
| + | [http://www.casino-theory.com/bingo-online/gambling-online-bingo.html gambling online bingo] | ||
| + | [http://www.gambling-online-theory.com/casinos/strategy-casinos.html strategy casinos] | ||
| + | [http://www.gambling-online-theory.com/online-casino/bet-online-casino.html bet online casino] | ||
| + | [http://www.magical-casino.com/casino_bonus.html Casino Bonus ] | ||
| + | [http://www.casino-theory.com/online-casino-bonus/online-casino-net.html online casino net] | ||
| + | [http://www.casino-theory.com/online-casino-bonus/online-casino-net.html online casino net] | ||
| + | [http://www.casino-theory.com/online-casino-bonus/free-online-casino-tournament.html free online casino tournament] | ||
| + | [http://www.fortune-slots.com/ online slots] | ||
Revision as of 16:43, 3 December 2006
Problem
You need to convert from an Erlang Date or Time tuple to RFC 1123 format Dates and Times.
Solution
The Erlang httpd_util module provides a solution:
1> CurrTime = erlang:universaltime().
{{2004,8,28},{8,15,38}}
2> httpd_util:rfc1123_date(CurrTime).
"Sat, 28 Aug 2004 08:15:38 GMT"
|
Most applications that use RFC 1123 or RFC 822 time formats require all output in GMT. However, Erlang does not provide support for RFC 822 formatted time, since it assumes all input times are GMT.
3> LocalTime = erlang:localtime().
{{2004,8,28},{1,19,37}}
4> httpd_util:rfc1123_date(LocalTime).
"Sat, 28 Aug 2004 01:19:37 GMT"
|
If you need to parse dates as input, you can use httpd_util:convert_request_date function:
5> DateString = "Wed, 28 Apr 2004 17:22:10 Z".
"Wed, 28 Apr 2004 17:22:10 Z"
6> httpd_util:convert_request_date(DateString).
{{2004,4,28},{17,22,10}}
|
RFC 1123 (and RFC 822) are used frequently as the basis for exchanging dates and times, particularly in Internet applications.
roulette tips fun casinos gambling online bingo strategy casinos bet online casino Casino Bonus online casino net online casino net free online casino tournament online slots

Digg It
Del.icio.us
Reddit
Facebook
Stumble Upon
Technorati

