PythonãRubyãNode.jsã§ï¼åå¾ãï¼æéå¾ãï¼æ¥å¾ã®æ¥ä»ãæ±ãã
python
from datetime import datetime, timedelta today = datetime.today() today + timedelta(minutes=1) # => 1åå¾ today + timedelta(hours=1) # => 1æéå¾ today + timedelta(days=1) # => 1æ¥å¾
ruby
require 'date' today = DateTime.now() today + Rational(1, 24 * 60 * 60) # => 1åå¾ today + Rational(1, 24) # => 1æéå¾ today + 1 # => 1æ¥å¾
ActiveSupportã使ã£ãã»ãã楽ã§ãã
require 'date' require 'active_support/core_ext' today = DateTime.now() today.since(1.minute) # => 1åå¾ today.since(1.hour) # => 1æéå¾ today.since(1.day) # => 1æ¥å¾
node.js
ãªããããã©ã¤ãã©ãªãªãããªã¨æã£ã¦æ¢ãããmomentã¨ããã®ãè¦ã¤ãã£ãã®ã§è©¦ãã¦è¦ã¾ãã
http://momentjs.com/
npm install moment
var moment = require('moment') var today = moment() today.add('minutes', 1) # => 1åå¾ today.add('hours', 1) # => 1æéå¾ today.add('days', 1) # => 1æ¥å¾