- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 05:21 AM
Hi Community
As part of sccm output for last login timestamp field I am getting some 18 digit number instead of date. How can I convert this into date n set in the target field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 05:33 AM
Hello @SnowUserDev
var timestamp = current.your_timestamp_field;
// Convert the 18-digit timestamp to milliseconds
var timestampInMillis = parseInt(timestamp);
var gdt = new GlideDateTime();
gdt.setNumericValue(timestampInMillis);
var formattedDate = gdt.getDisplayValue();
current.formatted_date_field = formattedDate;
Please mark my answer correct or helpful if it solves your problem.
Regards,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 05:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2024 01:03 AM
Hi @SnowUserDev ,
You can try creating a script include in global scope & make sure to set the field applicable from All application scopes
& Paste the code over der. In ur transform map script u can call the script include like below:
new global.ScriptincludeName().function name(pass variable here which contains 18 digit value);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 05:33 AM
Hello @SnowUserDev
var timestamp = current.your_timestamp_field;
// Convert the 18-digit timestamp to milliseconds
var timestampInMillis = parseInt(timestamp);
var gdt = new GlideDateTime();
gdt.setNumericValue(timestampInMillis);
var formattedDate = gdt.getDisplayValue();
current.formatted_date_field = formattedDate;
Please mark my answer correct or helpful if it solves your problem.
Regards,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 05:36 AM
Hi,
Check the SCCM stage table and transform map for this filed, also check the same column data in sccm. This should not come as 18 digit number.
-Thanks,
- AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 05:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 06:30 AM
I tried executing ur suggested script I'm background it is converting as desired. Thanks
@AshishKM there is one field from sccm which contains this values as 18 digit only.