Converting a date input as a string into a new format

You could do it in Ruby. This works, but doesn't feel quite right.

    ruby {
        code => '
            t = event.get("@timestamp")
            event.set("dateTime", Time.at(t.to_f).strftime("%Y.%m.%d %H.%M.%S"))
        '
    }