问题
I'm using Jquery FullCalendar and It has a method to be called when a date cell event click.
dayClick: function(date, allDay, jsEvent, view)
{
if (allDay)
{
alert('Clicked on the entire day: ' + date);
}else
{
alert('Clicked on the slot: ' + date);
}
}
It's kinda like above. But the date it prints or it has in date
is like this.
Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time)
How can I convert this kinda formatted string to a Java Date object.
When i parse it it will through a parseException
.
I need to get a Java Date object which has the format of yyyy-MM-dd
Updated :
Basically I need to convert a date string of format
Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time)
To a Java Date object. (specifically in format yyyy-MM-dd
)
回答1:
Basically I wanted to change the format of the FullCalendar date
object.
I achieved that by the following.
The date
has the following format by default. Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time)
var dd = $.fullCalendar.formatDate(date,"yyyy-MM-dd");
来源:https://stackoverflow.com/questions/22199066/convert-this-kind-of-date-format-tue-mar-04-2014-000000-gmt0530-sri-lanka-s