我已经看到很多关于如何从另一个日期时间中减去一个日期时间以及如何将年份添加到日期时间的信息。但以下让我很头疼。如何在 powerbuilder 中从日期中减去 1 分钟?请帮助和支持。
感谢和问候拉胡尔 G
我已经看到很多关于如何从另一个日期时间中减去一个日期时间以及如何将年份添加到日期时间的信息。但以下让我很头疼。如何在 powerbuilder 中从日期中减去 1 分钟?请帮助和支持。
感谢和问候拉胡尔 G
如果您使用的是 powerbuilder.net,您可以在 2 行代码中完成:
System.DateTime newDate
newDate = System.DateTime.Now.AddMinutes(-1);
这就是它在 PowerScript 中的完成方式。如果您使用 DateAdd 函数在 SQL 中执行此操作会更容易。
DateTime ldt_thedate, ldt_newdate
时间 lt_thetime
// 获取当前日期时间
ldt_thedate = DateTime(Today(), Now())
// 减去 1 分钟
lt_thetime = RelativeTime(Time(ldt_thedate), -1)
// 组装日期时间
ldt_newdate = DateTime(Date(ldt_thedate), lt_thetime)