Return self
as a String formatted as specified in RFC4517 (LDAP Generalized Time).
# File lib/treequel/monkeypatches.rb, line 153 def ldap_generalized( fraction_digits=0 ) fractional_seconds = if fraction_digits == 0 '' else '.' + ('0' * fraction_digits) end off = Time.now.utc_offset sign = off < 0 ? '-' : '+' tz = "%s%02d%02d" % [ sign, *(off.abs / 60).divmod(60) ] return "%02d%02d%02d%02d%02d%02d%s%s" % [ self.year, self.mon, self.day, 0, 0, 1, fractional_seconds, tz ] end
Returns self
as a String formatted as specified in RFC4517
(UTC Time)
# File lib/treequel/monkeypatches.rb, line 180 def ldap_utc off = Time.now.utc_offset sign = off < 0 ? '-' : '+' tz = "%s%02d%02d" % [ sign, *(off.abs / 60).divmod(60) ] return "%02d%02d%02d%02d%02d%02d%s" % [ self.year.divmod(100).last, self.mon, self.day, 0, 0, 1, tz ] end