Setting the start date through the web service

nathan.tanner's Avatar


29 Jun, 2010 06:32 PM

I'm struggling trying to set the startDate or endDate through a webservice using php. I have tried just specifying a string such as '2006-06-25T17:15:33' but the results are an incorrect start date.

How do I set the startDate with a webservice and php?

  1. 1 Posted by Penny on 29 Jun, 2010 08:05 PM

    Penny's Avatar

    Start Date and End Date are stored in Cascade as Unix timestamps. So you will probably need to change your date to that format.

  2. 2 Posted by Timothy Gilman on 29 Jun, 2010 08:33 PM

    Timothy Gilman's Avatar

    Here is some php code I used to convert a string date into a unix timestamp

        /* Construct start date field */
        $month_map = array ( 'Jan'=>'01', 'Feb'=>'02', 'Mar'=>'03', 'Apr'=>'04',
                             'May'=>'05', 'Jun'=>'06', 'Jul'=>'07', 'Aug'=>'08',
                             'Sep'=>'09', 'Oct'=>'10', 'Nov'=>'11', 'Dec'=>'12');
        $day = substr($pdata["pubDate"], 5, 2);
        $month_str = substr($pdata["pubDate"], 8, 3);
        $month = $month_map[$month_str];
        $year = substr($pdata["pubDate"], 12, 4);
        $pdata["startDate"] = mktime(1, 0, 0, $month, $day, $year);
  3. 3 Posted by nathan.tanner on 29 Jun, 2010 09:03 PM

    nathan.tanner's Avatar

    The knowledge base says
    'The metadata object contains the familiar "wired" fields from the metadata pane of an edit screen for metadata-aware objects. Most take a String - with the exception of the date fields, which take a long-formatted date String - of the format CCYY-MM-DDThh:mm:ss, such as 2006-06-25T17:15:33, which would be 5:15:33pm on 25 June, 2006 (more information here:'

    After looking over my code I found a programing error after correcting it the string as specified above worked.

    I used the jquery ui date selector then just appended the date string with . 'T12:00:00:00'

    Its working now! Thanks for everyone's help.

  4. Tim closed this discussion on 29 Jun, 2010 09:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac