- 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-21-2024 12:34 AM
Hi @Danish Bhairag2 @chetanb ,
The above script does not seem to be working in scoped application. Can u suggest an alternative or some workaround how can I get this running?
I have written this in robust transform map script section for the last login time field
- 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