I'm building a sitemap.xml using ruby, one input "lastmod" is expected
as :
<lastmod>2011-03-23T08:08:39+00:00</lastmod>
using :
File.mtime(path) i get :
<lastmod>2011-03-29 13:16:12 +0200</lastmod>
are those different ?
if yes, how to switch to the first one ?
···
--
« Je suis sûr que la gaîté ambiguë du drôle de garçon qui a bu du
whisky et fait le zèbre sur un vieux caïman à Noël dans le cañon, a été
bénéfique à l'âme du poète blême, ainsi qu'à son cœur & cætera ! »
(© Jean-Paul Blanc)
Hi,
I'm building a sitemap.xml using ruby, one input "lastmod" is expected
as :
<lastmod>2011-03-23T08:08:39+00:00</lastmod>
using :
File.mtime(path) i get :
<lastmod>2011-03-29 13:16:12 +0200</lastmod>
are those different ?
Yes. There are several formats to represent time.
And when you use in a sitemap.xml, you should represent
time in the former format [1].
[1] sitemaps.org - Protocol
if yes, how to switch to the first one ?
You can do it by using a Time#xmlschema method [2].
To use this method, you must do require 'time' module.
See example below:
[2] class Time - RDoc Documentation
$ irb
ruby-1.9.2-p136 :001 > require 'time'
=> true
ruby-1.9.2-p136 :002 > File.mtime( 'test' ).xmlschema
=> "2011-03-30T13:34:40+09:00"
Regards,
···
--
NOBUOKA Yu
ok, fine, cristal clear, thanks a lot !
···
Y. NOBUOKA <nobuoka@r-definition.com> wrote:
Yes. There are several formats to represent time.
And when you use in a sitemap.xml, you should represent
time in the former format [1].
[1] sitemaps.org - Protocol
> if yes, how to switch to the first one ?
You can do it by using a Time#xmlschema method [2].
To use this method, you must do require 'time' module.
See example below:
[2] class Time - RDoc Documentation
$ irb
ruby-1.9.2-p136 :001 > require 'time'
=> true
ruby-1.9.2-p136 :002 > File.mtime( 'test' ).xmlschema
=> "2011-03-30T13:34:40+09:00"
--
« A quoi bon soulever des montagnes quand il est
si simple de passer par-dessus ? »
(Boris Vian)