I’m building a sitemap.xml using ruby, one input “lastmod” is expected
as :
2011-03-23T08:08:39+00:00
using :
File.mtime(path) i get :
2011-03-29 13:16:12 +0200
are those different ?
if yes, how to switch to the first one ?
I’m building a sitemap.xml using ruby, one input “lastmod” is expected
as :
2011-03-23T08:08:39+00:00
using :
File.mtime(path) i get :
2011-03-29 13:16:12 +0200
are those different ?
if yes, how to switch to the first one ?
Hi,
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].
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,
Y. NOBUOKA [email protected] wrote:
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”
ok, fine, cristal clear, thanks a lot !
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs