简体   繁体   中英

Is there a way to get only month or only year from dateTime objects which are sent using json from database to javascript?

I have a table containing 2 dateTime columns 'start date' and 'Endate' ,I have passed the entire table to javascript using json,the format of data which I get when I access a particular date in the json table is dd/mm/yyyy (along with the default time),I need to get only date ie dd and only month ie mm from this format in javascript

Is there a way to do this ?

Date: the_string.split('/')[0]

Month: the_string.split('/')[1]

您可以使用正则表达式来解析数据。让我知道您是否需要样本内容方面的帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM