Warning when upgrading to Spotfire 10

TIBCO has deprecated the JQueryUI Javascript library in the latest Spotfire 10.0 release

TIBCO Community pages show us how to use JQuery properly

Parsing String Dates and Changing locale

from Spotfire.Dxp.Data.DataType import Date

#this will parse ok
print Date.Formatter.FormatString
print Date.Formatter.Parse("21Jun2000")
dt = Date.Formatter.Parse("7/28/2014")

#this line will crash
#print Date.Formatter.Parse("28/7/2014") 

#change the correct culture
from System.Globalization import CultureInfo
parser = Date.CreateCultureSpecificFormatter(CultureInfo("es-MX"))

#now is safe to parse
print parser.Parse("28/7/2014")
print parser.Parse("27-10-2014")
print parser.Parse("DEC31-2014")

#current date and time
from System import DateTime
now = DateTime.Now
today = DateTime.Today

#format date
dt =  Document.Properties["selectedDate"]  #01/15/2019
print dt.ToString("MMM yy") #shows Jan 19

No comments: