Help with Date field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 03:53 AM
Hello,
I have a date field on a catalog form. I basically need to get the value of the date in this field and today's date and then do some calculations. However, when I log the dates, I'm getting it in the wrong format and time zone. Screenshot attached, I need the scheduled date to show in the same format as todays date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 04:25 AM
@User485076 you need to use above code in server side script not in catalog client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 04:15 AM
Hi @User485076
Please let me know where you are running this script into ? Like in a catalog client script or a Script Include or a Fix Script ?
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 04:18 AM
It's a catalog client script. GlideDate is server side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 04:27 AM
Yes. It is server side script. you need to add in script include and call script include from catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 04:32 AM
Hi @User485076
If you want to handle this completely in your client script only, use below logic :
var today_date = new Date();
var day = today_date.getDate();
var month = today_date.getMonth();
month = month + 1;
var year = today_date.getFullYear();
var today_date_str = day + "-" + month + "-" + year;
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.