infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Tcl Library
TCL scrip for changing date from MM/DD/YYYY to YYYYMMDD
System
Originally posted by stephen fouche
# format into hl7 date format
lassign $xlateInVals date
set date [split $date /]
lassign $date m d y
set xlateOutVals
#set xlateOutVals
Find more posts tagged with
Clovertech
Comments
Jim Kosloskey
If one is at Cloverleaf release 6.1.1 or later, one can use thee Xlate STRING Action (range function) to pull out the pieces of the date (after all the pieces are always in the same place).
Then using the CONCAT Action combine the pieces back together as needed.
Could be used if the reverse is true (CCYYMMDD to MM/DD/CCYY).
Sean Farley
You have already broken the date into a list. Each element in the list is part of the new date format that you need. I think you can just change your last line to:
set xlateOutVals "[lindex $date 2][lindex $date 0][lindex $date 1]"
That should put it in YYYYMMDD format. I hope that helps.
Charlie Bursell
why not simply?
set dt 06/10/2017
set newdt [clock format [clock scan $dt] -format %Y%m%d]
Sean Farley
Charlie's answer is best! I wasn't sure if "clock scan" liked the MM/DD/YYYY" format, but I verified that it does in fact work.
set xlateOutVals [clock format [clock scan $date] -format "%Y%m%d"]
System
Originally posted by Mark Thompson
Not sure how Charlie let this slip through - xlateOutVals should always be a list. In this particular case it doesn't matter, but best practice would be:
set xlateOutVals [list [clock format [clock scan $dt] -format "%Y%m%d"]]