The Siemens Community Catalyst program was co-created with our community to acknowledge technology leaders who consistently contribute to the Siemens Community. Nominations are accepted on a rolling basis.
need help in changing dates from 7222017 to 07222017
Hi,
If it's a date field, you can select Long Date, Short Date etc from the properties of the field, but leading zeros and/or separators are controlled by the Windows regional settings of your PC.
M/d/Y will result in a date displaying as 1/1/17 and MM/DD/YYYY will result in 01/01/2017 for example.
If it's a character field, then it' depends on whether you can tell the month and day apart. Would 1112017 be 11th Jan or 1st November - or could it be either? If it's only ever the ultimate leading zero that is missing and therefore you would 11012017, then the following calculation will fix it.
Right("0" + [YourOriginalFieldName],8)
0" + [YourOriginalFieldName] will add the leading zero, whether you need it or not;
"12122017" goes to 012122017 for 12th December
"1012017" goes to 01012017 for 1st January
Then take the right hand 8 characters with Right("0" + [YourOriginalFieldName],8);
"012122017" trims back to 12122017 for 12th December
"01012017" stays at 01012017 for 1st January
Finally, if it's a numeric field, you can convert it to character and add the leading zero using the expression
Str([YourOriginalFieldName],8,0,"0")
Regards,
Steve.
Hi, If it's a date field, you can select Long Date, Short Date etc from the properties of the field, but leading zeros and/or separators are controlled by the Windows regional settings of your PC. M/d/Y will result in a date displaying as 1/1/17 and MM/DD/YYYY will result in 01/01/2017 for example. If it's a character field, then it' depends on whether you can tell the month and day apart. Would 1112017 be 11th Jan or 1st November - or could it be either? If it's only ever the ultimate leading zero that is missing and therefore you would 11012017, then the following calculation will fix it.Right("0" + [YourOriginalFieldName],8) 0" + [YourOriginalFieldName] will add the leading zero, whether you need it or not; "12122017" goes to 012122017 for 12th December"1012017" goes to 01012017 for 1st January Then take the right hand 8 characters with Right("0" + [YourOriginalFieldName],8);"012122017" trims back to 12122017 for 12th December"01012017" stays at 01012017 for 1st January Finally, if it's a numeric field, you can convert it to character and add the leading zero using the expressionStr([YourOriginalFieldName],8,0,"0") Regards,Steve.
Perfect!!!
Thanks for your help.
Dan
Join us for a community conversation on how High-Performance Computing (HPC) and Simcenter PSIM work together to meet the increasing demands of modern power electronics simulation. During this one-hour technical session, you'll discover how leveraging HPC can speed up simulations, improve scalability, and empower engineers…
Join us for a community conversation on accelerating your motor simulation workflow with Simcenter Simlab. In this beginner-friendly session, we'll introduce the platform's automated model-building capabilities and show how easy it is to set up your first electric motor analysis. You'll see the basic steps of geometry…
Join us for a Community Conversation where we'll discuss practical approaches to analyzing complex electromagnetic models using hybrid solver techniques. This session will provide a general overview of how different computational methods can be combined within a single simulation to address models containing varied…