new GlideDateTime().getDate(); this is giving complete date in" YYYY/MM/DD" format, I want only month and year in "MM/YYYY" this format .....what is script for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 06:22 AM
new GlideDateTime().getDate(); this is giving complete date in" YYYY/MM/DD" format, I want only month and year in "MM/YYYY" this format .....what is script for this
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 06:35 AM
Hi animesh
Try this code to get month and year seperately.
var x= new GlideDateTime().getDate();
var year = x.getYear();
var month = x.getMonth();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 06:42 AM
Yes you can also use getByFormat as suggested by monica
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 06:35 AM
Hello Animesh,
Try using below code:
var a = new GlideDateTime().getDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 06:57 AM