webmcp

diff framework/env/format/timestamp.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children 08c107cc4fce
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/format/timestamp.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,19 @@
     1.4 +--[[--
     1.5 +text =                 -- text with the given timestamp value formatted according to the locale settings
     1.6 +format.timestamp(
     1.7 +  value,               -- a timestamp or nil
     1.8 +  {
     1.9 +    nil_as = nil_text  -- text to be returned for a nil value
    1.10 +  }
    1.11 +)
    1.12 +
    1.13 +Formats a timestamp according to the locale settings.
    1.14 +
    1.15 +--]]--
    1.16 +
    1.17 +function format.timestamp(value, options)
    1.18 +  if value == nil then
    1.19 +    return options.nil_as or ""
    1.20 +  end
    1.21 +  return format.date(value, options) .. " " .. format.time(value, options)
    1.22 +end

Impressum / About Us