- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 03:23 AM
Hi Experts
by using new Date() at client side I'm getting the currrent date
and a UI page date select field is giving me this value
Now I want to compare the selected value with current value to show user a message to change the date to a future date. Server vaidation is present but I need a client popup msg, so they can update the value/ or know why the server did not enter the record as it goes with screen reload.
Please let me know how can I convert 1st value (i.e current date to 2nd date format for validation)
Regards,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 04:22 AM
Hi @saint ,
Please use the following code to convert the date to yyyy-mm-dd format
var date = new Date();
var d = date.toISOString().split('T')[0];
alert(d);
Output:
If my answer has helped with your question, please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 04:04 AM
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
In your brower console run this to see an example
var date = new Date();
date.toDateString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 04:22 AM
Hi @saint ,
Please use the following code to convert the date to yyyy-mm-dd format
var date = new Date();
var d = date.toISOString().split('T')[0];
alert(d);
Output:
If my answer has helped with your question, please mark it as correct and helpful
Thanks!