帆软日期格式化

在点击单选按钮组件是通过点击给另一个日期控件的单元格赋一个当前日期 日期格式为yyyy-mm-dd hh:mm:ss

FineReport 念人 发布于 2020-11-5 10:02
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
1
cherishdqyLv7高级互助
发布于2020-11-5 10:23

建议用js获取,fr在时间里用公式获取到的是打开报表的时间,不是点击时间

Date.prototype.Format = function(fmt) { // author: meizz
	var o = {
		"M+": this.getMonth() + 1, // 月份
		"d+": this.getDate(), // 日
		"h+": this.getHours(), // 小时
		"m+": this.getMinutes(), // 分
		"s+": this.getSeconds(), // 秒
		"q+": Math.floor((this.getMonth() + 3) / 3), // 季度
		"S": this.getMilliseconds() // 毫秒
	};
	if (/(y+)/.test(fmt))
		fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	for (var k in o)
		if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	return fmt;
}

var time = new Date().Format("yyyy-MM-dd hh:mm:ss"); 
contentPane.setCellValue("B1", null, time)


最佳回答
0
snrtuemcLv8专家互助
发布于2020-11-5 10:02(编辑于 2020-11-5 10:09)

format(日期,"yyyy-MM-dd hh:mm:ss")


image.png

  • 念人 念人(提问者) contentPane.setCellValue(\"H78\",null,format(new Date(),\"yyyy-MM-dd hh:mm:ss\")) 这样写吗
    2020-11-05 10:05 
  • snrtuemc snrtuemc 回复 念人(提问者) js写法参考修改答案图片
    2020-11-05 10:10 
  • 3关注人数
  • 2593浏览人数
  • 最后回答于:2020-11-5 10:23
    请选择关闭问题的原因
    确定 取消
    返回顶部