JSON Parse Date Format

Code to extract Date or Year from JSON Format Date value


function GetDate()
	var dateString = "\/Date(1453032289681)\/".substr(6);
	var currentTime = new Date(parseInt(dateString ));
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var date = day + "/" + month + "/" + year;
	return false;


<input type='button' Value='Get Date' onclick="return GetDate()"/>


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s