How to get only Date value from Date/Time field in Client script?

rathikaramamurt
Giga Expert

Hi Experts,

I have a Date/Time field as below:

find_real_file.png

I only require Date to be fetched from this field using client script.

Could anyone pls help?

Thanks,

Rathika

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

My recommendation would be to parse the display value of the object. You should be able to do this with a clever split() method.



If that's not an option, use a GlideAjax operation to send the date time to the server, parse it there, convert it to a date object and send it back.



something like this. WARNING: Untested code!



var dateTimeStr = g_form.getValue('u_date_time');


var dateArr = dateTimeStr.split(' ');


var date = dateArr[0];


View solution in original post

7 REPLIES 7

You are welcome. Please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.


If you are viewing this discussion from your "inbox", use the "mark as correct" option under actions. If you are viewing it directly from the thread use the Correct Answer link (red with a star).


Thank you


but it split[0] only gives only 0th indexed element in split array 

eg :- if it is 19-02-2019

it replies only 1 

how can we get entire date field

The script he provided did a split on space, so it gives you the entire date, not just the first digit.