Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question

You must login to ask question.

Login

Register Now

APPSeCONNECT community provides a new way for integration super heros connect the external world. Join hands together to build a community of people to help each other, solve problems or share knowledge.

Working with DateTime

Working with DateTime

Datetime is one of the most complex primitive data type which one needs to understand while working with the transformation in APPSeCONNECT. This article will help you understand how we can make use of Datetime field efficiently and effectively such that all the destination data is compatible.

Steps to define date time field

A DateTime is an inherent property of a particular attribute of a schema. The attribute can be source attribute or a target attribute.  By source schema we mean the schematic definition of the data that an application interact with.  APPSeCONNECT supports different primitive data types in addition to DateTime. To define DateTime field in a schema, we need to first create an attribute on that particular schema. To do such a thing, please follow the steps mentioned below :

  1. Open portal.appseconnect.com
  2. Go to App Section and click on Schema of a particular Application.
  3. You can add a new Schema from there, which will allow you to define a schema for a particular endpoint
  4. You can add as many fields as you want, each attribute will have its type. (DateTime for instance).

Also Check out: Integrating Business Applications – 5 Key Points to Consider

Once the date is mentioned on a particular schema, you can use it to store date time during transformation.  You can read the documentation to know more on how to add or import schema in APPSeCONNECT.

The transformation allows you to pick a particular field, do execute a logic that you define per field, and then create a separate document. The transformation lets you define the fields that you want to expose to the target document, such that you can push the document easily. Now while defining transformation, you might need some tooling which you want to execute on a datetime field to get proper results. Let us discuss how to do such a thing using APPSeCONNECT transformation engine.

Some common methods to transform Datetime field:

Requirement Syntax Description
Get date or a default date [genericlib:GetDataOrDefault(data,defaultText)] The idea is to generate a default data if there is no data present for a particular mapping
Format date or a default date [genericlib:GetDateFormattedOutput(data,formatspecifier,defaultDate)] This mapping will reformat the data using a format specifier or else will return a dummy date specified as third parameter.
Get reformatted Local or UTC datetime [genericlib:GetLocalTime(format)] / [genericlib:GetUniversalDateTime(format)] This mapping will just get the current datetime or current Universal datetime and reformat the data using a format specifier.
Gets a local or UTC datetime [genericlib:GetUtcTime()] / [genericlib:GetLocalDateTime()] This mapping will just get the current datetime or current Universal datetime
Adds a number of days to a date [genericlib:DateAdd(datestring,no_of_days)] Add a number of days mentioned in parameter to a specific date and returns the output.
Reformat a date [genericlib:FormatDate(date,format)] Just takes a date and reformat it to a valid format.
Generate a datetime [genericlib:DateFromParts(year,month,day)][genericlib:TimeFromParts(hour,minute,seconds,fractions,precision)] Both DateFromParts and TimeFromParts allows to generate date time, by specifying the date and part elements in parameter.
Check for Date [genericlib:IsDate(date)] Identifies whether the date passed as parameter is a valid date or not.
Days elapsed between two dates [genericlib:DateDifference(date1,date2,format, range)] Returns the number of days or month or year elapsed between two date. Value of range could be “month”, “year”, “day”.

Note : It is worth noting, the transformation engine always parses the datetime field into its own format, so if you do not specify the format of an output, the transformation engine will generate the format and return result.

About Abhishek SurVerifiedBeginner

VP, Products at InSync Abhishek Sur has been a Microsoft MVP since 2011. He is currently working as a Product Head with Insync Tech-Fin Solutions Pvt Ltd. He has profound theoretical insight and years of hands-on experience in different .NET products and languages. Over the years, he has helped developers throughout the world with his experience and knowledge. He owns a Microsoft User Group in Kolkata named Kolkata Geeks and regularly organizes events and seminars in various places to spread .NET awareness. A renowned public speaker, voracious reader, and technology buff, Abhishek's main interest lies in exploring the new realms of .NET technology and coming up with priceless write-ups on the unexplored domains of .NET. He is associated with Microsoft's Insider list on WPF and C# and stays in touch with Product Group teams. He holds a Master's degree in Computer Application along with various other certificates to his credit. Abhishek is a freelance content producer, developer, and site administrator. His website www.abhisheksur.com guides both budding and experienced developers in understanding the details of languages and latest technologies. He has a huge fan following on social networks. You can reach him at books@abhisheksur.com, get online updates from his Facebook account, or follow him on Twitter @abhi2434.

Follow Me

Leave a reply

Share via
Copy link
Powered by Social Snap