向指定日期添加X天的脚本? [英] Script that adds X days to a given date?

查看:139
本文介绍了向指定日期添加X天的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可能指向我或写一个需要X天的脚本/程序,并将其添加到指定的日dd / mm / yy,并以dd / mm / yy格式输出日期。非常感谢!

Can someone point me to or write a script/program that takes X days and adds that to a given day dd/mm/yy and outputs the date in dd/mm/yy format. Thanks!

推荐答案

在Ruby中:

require 'rubygems'
require 'active_support'

def date_a(x, y)
  (Date.parse(x) + y.days).strftime("%d/%m/%y")
end

这篇关于向指定日期添加X天的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆