- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 08:31 AM
I have a date field that I would like to default to tomorrows date. I can use javascript:gs.daysAgo(-1) as a default if the field is date/ time.
If I use that on a field that is just "date" I get the following populated
Any ideas on how I can fix this? I would love to use only the date and not have to see the time as well as it wont be used.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 09:40 AM
gs.daysAgo() will always return the date in system format (yyyy-MM-dd). Use this in the default value and you should be good to go
javascript: var gdt = new GlideDateTime(); gdt.addDaysLocalTime(-1); gdt.getLocalDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 08:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 08:54 AM
This little Business Rule script will do the job
function setDate() {
var now = new GlideDateTime();
now.addDaysLocalTime(1);
current.u_move_date = now.getValue();
}
setDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 08:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 09:40 AM
gs.daysAgo() will always return the date in system format (yyyy-MM-dd). Use this in the default value and you should be good to go
javascript: var gdt = new GlideDateTime(); gdt.addDaysLocalTime(-1); gdt.getLocalDate();