Seconds field is not updating for datetime field in Database.

Certified Senior Developer

I have a datetime field as "2018-11-08T11:23:34+0000". I want to add this to database in a datetime type column. I'm using totime("11:23:34") but the 'seconds' field always showing '00'. How do I update 'seconds' field in database?

  Discussion posts and replies are publicly visible

Parents
  •  Appian datetime and MySQL datetime formats are different so I suggest writing an expression rule to cast Appian datetime to MySQL's "YYYY-MM-DD HH:MM:SS" format. You might have to modify the provided code to suit your needs.

     

    load(
      local!dt: now(),
      local!AppianDateTimeString: tostring(
        local!dt
      ),
      /* MySQL retrieves and displays DATETIME
      values in 'YYYY-MM-DD HH:MM:SS' format */
      local!MySQLDateTimeString: joinarray(
        {
          /* Date string */
          joinarray(
            {
              year(local!dt),
              month(local!dt),
              day(local!dt)
            },
            /* forward slash */
            char(45)
          ),
          /* Time string */
          joinarray(
            {
              hour(local!dt),
              minute(local!dt),
              second(local!dt)
            },
            /* colon */
            char(58)
          )
        },
        /* space */
        char(32)
      ),
      {
        /* Appian Datetime String */
        local!AppianDateTimeString,
        /* MySQL Datetime String */
        local!MySQLDateTimeString
      }
    )

Reply
  •  Appian datetime and MySQL datetime formats are different so I suggest writing an expression rule to cast Appian datetime to MySQL's "YYYY-MM-DD HH:MM:SS" format. You might have to modify the provided code to suit your needs.

     

    load(
      local!dt: now(),
      local!AppianDateTimeString: tostring(
        local!dt
      ),
      /* MySQL retrieves and displays DATETIME
      values in 'YYYY-MM-DD HH:MM:SS' format */
      local!MySQLDateTimeString: joinarray(
        {
          /* Date string */
          joinarray(
            {
              year(local!dt),
              month(local!dt),
              day(local!dt)
            },
            /* forward slash */
            char(45)
          ),
          /* Time string */
          joinarray(
            {
              hour(local!dt),
              minute(local!dt),
              second(local!dt)
            },
            /* colon */
            char(58)
          )
        },
        /* space */
        char(32)
      ),
      {
        /* Appian Datetime String */
        local!AppianDateTimeString,
        /* MySQL Datetime String */
        local!MySQLDateTimeString
      }
    )

Children
No Data