+ Start a Discussion

How to Assign a DateTime field value to another Datetime field?


 I want to assign an datetime field value to another datetime field.
 I tried the following ways, any help on this highly appreciated.

1. var day1 = Day( {!Event.StartDateTime} );
    var month1 = Month( {!Event.StartDateTime} );
    var year1 = Year( {!Event.StartDateTime} );
    var time = {!Event.StartDateTime}.getTime();
    var myDate = new Date(year1, month1, day1 time);
    var endDate = new Date(year1, month1, day1 time);

2. var myDate = new Date("yyyy-mm-dd HH:MM:SS");
    myDate = "2013-06-15T14:50:30Z";
    myDate = '{!Event.StartDateTime}';

3. var dateVar = new Date("2013-06-15T14:50:30Z");
    dateVar = '{!Event.StartDateTime}';

Any suggestions?
Yes, move to Visualforce and use Apex, e.g.:

public class datetimetest {
    public void setdatetime() {
        Event e = new Event();
        Datetime d = e.activitydatetime;


Hi Andrew,

  Thanks for your reply.
  But my requirement is I need to use in s-control.
  Please let me know whether it is possible in s-control or not?

Should be possible but you'll need someone else to show you how.  Not sure who's driving your requirements but they should know we're not investing in s-control technology any more.
Thanks for your reply, it is really sounds good.

  So one more thing if you have sample code for datetime please post it here
  I have not found any example on datetime using s-controls.

  Waiting for your answer.

did you every find a solution to this ??