Using Dates & Times
Hi,
I'm having some difficulty using a Method to provide input to a Reqest via a Form XML window. I'm using the getTime() funciton that was posted on your forum as well as using examples from other folks:
**** Code ****
from java.util import *
from java.text import *
def getTime():
# Get an instance of the calendar
calendar = Calendar.getInstance()
# Set the day in the calendar
day = calendar.get(Calendar.DAY_OF_WEEK)
calendar.set(Calendar.DAY_OF_WEEK, day+1)
# Retreive the date from the calendar
date = calendar.getTime()
# Create the date formatter
# myFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
myFormat = "yyyy-MM-dd'T'00:00:00"
formatter = SimpleDateFormat(myFormat)
# Create, print, and return the timestamp
timestamp = formatter.format(date)
print timestamp
return timestamp
********
I'm trying to set a date field with a data (today+1). Where do I place the method so that I can parameterize the tag?
Robert A. Ramirez
I'm having some difficulty using a Method to provide input to a Reqest via a Form XML window. I'm using the getTime() funciton that was posted on your forum as well as using examples from other folks:
**** Code ****
from java.util import *
from java.text import *
def getTime():
# Get an instance of the calendar
calendar = Calendar.getInstance()
# Set the day in the calendar
day = calendar.get(Calendar.DAY_OF_WEEK)
calendar.set(Calendar.DAY_OF_WEEK, day+1)
# Retreive the date from the calendar
date = calendar.getTime()
# Create the date formatter
# myFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
myFormat = "yyyy-MM-dd'T'00:00:00"
formatter = SimpleDateFormat(myFormat)
# Create, print, and return the timestamp
timestamp = formatter.format(date)
print timestamp
return timestamp
********
I'm trying to set a date field with a data (today+1). Where do I place the method so that I can parameterize the tag?
Robert A. Ramirez
0
Comments
To format the output so that the XML Databank can store it, simply replace "return timestamp" with:
return SOAPUtil.getXMLFromString([timestamp])
I have included an example .tst file which demonstrates this functionality. Hope this helps.
Regards,
Joseph
I apprieciate the response...works like a charm. Where are you finding the syntax for the additions to the code I posted. Is it standard Python? I would not have know to look for a function "getXMLFromString" in order for this code to work.
Robert
Regards,
Joseph