Skip to content

naritta/mruby-strptime

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

mruby-strptime

install by mrbgems

MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :github => 'naritta/mruby-strptime'
end

Example

# parsed hash
Strptime.parse('2017-07-07T23:59:01+0700') 
# => {"year"=>2017, "mon"=>7, "mday"=>7, "hour"=>23, "min"=>59, "sec"=>1, "zone"=>"+0700", "offset"=>"+0700"}

# unix time included timezone
Strptime.new('2017-07-07T23:59:01').to_i
# => 1499439541

# unix time included timezone
Strptime.new('2017-07-07T23:59:01+0700').to_i
# => 1501959541

# time without timezone
Strptime.new('2017-07-07T23:59:01').to_time
# => Fri Jul 07 23:59:01 2017 

License

MIT

About

mruby implementation of strptime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published