Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:50:30+00:00 2026-06-05T20:50:30+00:00

I’m using jQuery widgets DatePicker and Dialog to interact with fullCallendar by Adam Shaw

  • 0

I’m using jQuery widgets DatePicker and Dialog to interact with fullCallendar by Adam Shaw http://arshaw.com/fullcalendar. I have a lot of things working. I can use the DatePicker to jump to a specific date in fullcalendar. When I make a selection to book an event, the jQuery Dialog comes up and I use an ajax call to send the fields to a php script to process the data.

My problem, however, comes from the UNIX timestamps used in fullcalendar’s start and end variables. I set a global variable at the top of my html file, and set the start/end times from the selection in fullcalendar so that the data is passed around to the Dialog. From Dialog, I pass it to my PHP script. But when I convert that UNIX timestamp to a date in format ‘YmjHis’, I get weird results.

Here is the relevant code from the “select” method in fullcalendar:

select: function(start, end, allDay) { 
        // need to check the day first. If the selected day/time < today, throw an alert
        // otherwise allow the booking of the conference.
            var now = calendar.fullCalendar('getDate');
            if (start < now )
            {
                alert('You cannot book a conference in the past!');
                calendar.fullCalendar( 'unselect' );
            }
            else
            {
                                    // set the global variables
                st = start;
                et = end;

                $('#dialog-form').dialog('open'); // open the dialog form
            }

            },

Now, in the dialog does this (which is mostly taken directly from the jQuery UI examples page:

$( "#dialog-form" ).dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        buttons: {
            "Create Event": function() {
                var bValid = true;
                allFields.removeClass( "ui-state-error" );

                bValid = bValid && checkLength( name, "name", 3, 25 );
                bValid = bValid && checkLength( title, "title", 1, 20 );
                bValid = bValid && checkLength( email, "email", 6, 80 );
                bValid = bValid && checkLength( ports, "ports", 1, 2 );

                bValid = bValid && checkRegexp( name, /^[a-z]([0-9a-z_])+$/i, "Name may consist of a-z, 0-9, underscores, begin with a letter." );
                // From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
                // change to ensure a domain email address
                bValid = bValid && checkRegexp( email, /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "eg. ui@jquery.com" );

                if ( bValid ) {
                    // code to insert into DB goes here
                    // need to somehow grab either a global variable or access
                    // full calendar start/end times from the selection phase
                    // in order to pass to the DB. 
                    $.ajax(
                    {
                        url: "bookings.php",
                        type: "POST",
                        data: {e: email.val(), t: title.val(), n: name.val(), p: ports.val(), start: +st, end: +et},                
                        dataType: "HTML",
                        success: function(data) {
                                $('.result').html(data);
                                // reload fullCalendar here maybe??
                            }
                    });
                    $( this ).dialog( "close" );
                }
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        },
        close: function() {
            allFields.val( "" ).removeClass( "ui-state-error" );
        }
    });

Ok, now my bookings.php file just has the following test code:

$file = 'variables.txt'; 
$arr= $_REQUEST; 
$fp = fopen($file, 'w') or die('Could not open file!');  
fwrite($fp, "variables are:\n");
foreach ($arr as $key => $value) { 
    $toFile = "Key: $key; Value: $value \n"; 
// write to file  
fwrite($fp, "$toFile") or die('Could not write to file'); 
}

// DEBUG CODE write some blank space
fwrite($fp, "\n\n") or die('Could not write to file');
$startTime = $_REQUEST['start'];
$endTime = $_REQUEST['end'];

$start = date('YmjHis', $startTime);
fwrite($fp, "start time: $startTime = $start\n") or die('Could not write to file');
$end = date('YmjHis', $endtime);
fwrite($fp, "end time: $endTime = $end\n") or die('Could not write to file');

// close file  
fclose($fp);

When I look at my variables.txt file, I see this:

Key: e; Value: me@blah.com
Key: t; Value: blah
Key: n; Value: blah
Key: p; Value: 2
Key: start; Value: 1339610400000
Key: end; Value: 1339617600000


start time: 1339610400000 = 444200724160000
end time: 1339617600000 = 19691231160000

What I would expect is for the start and end times to have a format like: 20120613113000, oh and not end with a 1969 date.

So I’m obviously doing something wrong in my conversions. This is the last hurdle to a full implementation of fullCalendar to do what I need it to do, and I’m stumped. Any help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:50:31+00:00Added an answer on June 5, 2026 at 8:50 pm

    Right now it looks like there are are too many zeros in your start time and end time. My guess is it getting padding from some reason when you pull it out of the request.

    Unix Conversion

    StartTime
    1339610400000 = 07/24/20 @ 6:00:00pm EST in (M/D/Y @ h:m:s)

    EndTime
    1339617600000 = 10/16/20 @ 2:00:00am EST in (M/D/Y @ h:m:s)

    I’m thinking that you are working with date not in 2020 but in 2012 so I shorten the numbers above down to 10 digits (current TS as of 6/12/2012 @ 12:57pm = 1339610258 )

    Start Time
    1339610400 = 06/12/12 @ 1:00:00pm EST

    End Time
    1339617600 = 06/13/12/ @ 3:00:00pm EST

    Now that looks more like a date you would book in a calendar.

    My guess is you are getting extra zeros some where in your date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.