如何在 Maximo 的自动化脚本中向当前日期添加 1 秒
How to add 1 second to the current date in automation script in Maximo
如何将 Python 中的当前日期加 1 秒。我能够分别获取当前日期和秒数,但是我不确定如何为其添加 1 秒。
currentDate = MXServer.getMXServer().getDate()
currentSecond = currentDate.getSeconds()
newSecond = currentSecond - 1
您必须使用日历。例如..
from java.util import GregorianCalendar
from psdi.server import MXServer
currentDate = MXServer.getMXServer().getDate()
cal = GregorianCalendar()
cal.setTime(currentDate)
cal.add(cal.SECOND, 1)
print "currentDate: %s\nplusSecond: %s" % (currentDate.toString(), cal.getTime().toString())
如何将 Python 中的当前日期加 1 秒。我能够分别获取当前日期和秒数,但是我不确定如何为其添加 1 秒。
currentDate = MXServer.getMXServer().getDate()
currentSecond = currentDate.getSeconds()
newSecond = currentSecond - 1
您必须使用日历。例如..
from java.util import GregorianCalendar
from psdi.server import MXServer
currentDate = MXServer.getMXServer().getDate()
cal = GregorianCalendar()
cal.setTime(currentDate)
cal.add(cal.SECOND, 1)
print "currentDate: %s\nplusSecond: %s" % (currentDate.toString(), cal.getTime().toString())