Current time in numeric value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2011 11:14 AM
Is it possible to get the current time(only the time) in numeric value?Thanks
Labels:
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2011 06:50 AM
var theTime = nowDateTime().toString().split(' ')[1];
This would return the current time in hh:mm:ss format. Is that what you are looking for?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2011 11:18 AM
If you need to convert a date and time to a numeric value. You need to use the following.
current.my_date_field.getGlideObject().getNumericValue();
This will convert to a numeric value not just a string. Here is a wiki article that compares 2 date fields
http://wiki.service-now.com/index.php?title=Compare_Two_Date_Fields
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 02:56 AM
var today = new GlideDateTime();
gs.print(today.getTime().getNumericValue()/1000); // time, in seconds
is probably what you're after.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2011 04:51 PM
Thanks everyone and James gave the exact script what i was looking for.