Get today's date in User's timezone - Workflow script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2011 06:32 AM
In workflow script, I am using gs.now() to get today's date in wait for condition. If it is today's date then only tasks need to be created.
In the system timezone property, US / Eastern time is configured. I know gs.now() gets the current date using GMT.
Is there anyway to get the current date using specified time zone?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2011 10:18 AM
Not sure if this is the best way, but it seems to work.
var gdt = new GlideDateTime();
gdt.addSeconds(gdt.getTZOffset() / 1000);
var dateInMyTZ = gdt.getDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2011 05:51 AM
Thanks Tony. It helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2011 05:41 AM
If you want to find out the start of today, local time, in order to compare other times against it (e.g. for a query) you can use:
var today = gs.beginningOfToday();
the time string it gives is in GMT, but it represents your midnight. As an example, if your TZ was 'US/Pacific' then gs.beginningOfToday() would return "2011-11-21 08:00:00", if your TZ was 'Australia/South' it would return "2011-11-20 13:30:00"