Fullcalendar结束我实际选择的小时后10分钟的开始时间

时间:2017-10-01 23:00:06

标签: javascript php fullcalendar

我正在开发一个带有fullcalendar的预订平台,现在当我将开始和结束时间发送到PHP(它实际上是laravel)文件时保存信息数据库,时间是我实际选择的小时后10分钟,例如,如果我选择10:00到12:00 fullcalendar发送10:10到12:10,我不确定它是格式化还是什么,我一直在论坛中寻找但我已经没什么,帮忙!谢谢!

这是我格式化时间的方式:

<!DOCTYPE html>
<html>
<head>
    <style>

</style>
<title>lab 8</title>
<script type="text/javascript">

    var myWin = window.open("", "myWin", "height=500, width=500,location,menubar,toolbar,status,resizable");



    function movie(movie_title, website_title, actor, website_actor)
        {
            this.the_movie_title = movie_title;
            this.the_website_title = website_title;
            this.the_actor = actor;
            this.the_website_actor = website_actor;

        }



        var myMovie = new movie("Before she was Wonder Woman, she was Diana, princess of the Amazons, trained to be an unconquerable warrior. Raised on a sheltered island paradise, Diana meets an American pilot (Chris Pine) who tells her about the massive conflict that's raging in the outside world. Convinced that she can stop the threat, Diana leaves her home for the first time. Fighting alongside men in a war to end all wars, she finally discovers her full powers and true destiny.", 

            "http://www.imdb.com/title/tt0451279/",

            "Gal Gadot is an Israeli actress, singer, martial artist, and model. She was born in Rosh Ha'ayin, Israel, to an Ashkenazi Jewish family. Her parents are Irit, a teacher, and Michael, an engineer, who is a sixth-generation Israeli. She served in the IDF for two years, and won the Miss Israel title in 2004.", 

            "http://www.imdb.com/name/nm2933757/?ref_=tt_cl_t1");


    myWin.document.write(

        +"  <script type='text/javascript'>"

        +"      function movieWin() {"
        +"  var movieWin = window.open(\"movie.website_title\" , \"movieWin\", \"height=500, width=500,location,menubar,toolbar,status,resizable\");"
        +"      }"

        +"      function actorWin() {"
        +"  var actorWin = window.open(\"movie.actor" , "actorWin", "height=500, width=500,location,menubar,toolbar,status,resizable\");"
        +"     <p style='color: green; font-size: 17px;'>"
        + movie.actor
        + "<a href='javascript:(\""+movie.website_actor+"\");'>Click for more info</a>"
        +"      </p>"
        +"      } "
        +"  <\/script>"

        );

     myWin.document.write(
    +"  <script type='text/javascript'>"
    +   "<body style='background-image : url(lab8_images/back.png)'>"
    +   "<h1 style= 'text-align: center; color: white; font-family: monospace; font-size: 200%'> What about this movie? </h1>"
    +    '<br/>' + '<br/>' +'<br/>' 
    +  "<p style = 'font-family: monospace; font-size: 150%; color: #ffffff; text-align:center; text-decoration: none'> <a href = 'javascript:movieWin()'> CLICK HERE TO ACCESS TO THE MOVIE WINDOW </a><br></p>"
    +   "<p style = 'font-family: monospace;font-size: 150%; color: #ffffff;  text-align: center; text-decoration: none'> <a href ='javascript:actorWin();'> CLICK HERE TO ACCESS TO THE ACTOR WINDOW </a><br></p>"
+"  <\/script>"
        );

</script>

</head>
<body background = lab8_images/back.png>

</body>
</html>

这些是我的日历设置:

save_start = $.fullCalendar.formatDate(start , "YYYY-MM-DD HH:MM:SS");
save_end   = $.fullCalendar.formatDate(end, "YYYY-MM-DD HH:MM:SS");

1 个答案:

答案 0 :(得分:0)

这与额外10分钟无关,这是格式字符串中的一个简单错误。

fullCalendar使用下面的momentJS来格式化日期。您可以使用以某种格式输出的令牌:http://momentjs.com/docs/#/displaying/format/

您正在使用代表数月的MM。由于当月是十月,这可能就是你看到10的原因。上个月你已经看过09.你需要用mm来代表分钟。你有一个类似的问题秒 - 技术上你输出小数秒,虽然选择的细节水平意味着你可能没有注意到。

此:

save_start = $.fullCalendar.formatDate(start , "YYYY-MM-DD HH:mm:ss");
save_end   = $.fullCalendar.formatDate(end, "YYYY-MM-DD HH:mm:ss");

会给你正确的结果。