Forum Discussion

SamKrausz's avatar
SamKrausz
Qrew Cadet
8 years ago

Change text field to date:time

How can I change this: shipment-date
2017-06-25T04:59:14+00:00 which is now a text field to this: 2017-06-25 04:59:14 as a date/time field

What is the formula syntax to do it?
  • Try this

    var Date DatePart = Left([shipment-date],"T");
    var TimeOfDay TimePart = Right([shipment-date],"T");

    ToTimeStamp($DatePart, $TimePart )
  • Thanks for your help

    But....

    I am getting an error "incorrect variable type"

    Any idea what this is?
  • re: Any idea what this is?
    yes: Sloppiness on my part :)

    OK, let's try that again
    Try this

    var Date DatePart = ToDate(Left([shipment-date],"T"));
    var TimeOfDay TimePart = ToTimeOfDay(Right([shipment-date],"T"));

    ToTimeStamp($DatePart, $TimePart )
  • I am not getting any error massages

    But when I save it, the cell is blank, no data in the cell
  • OK, this is tested

    var date DatePart = Date(
    ToNumber(Left([shipment-date],4)),
    ToNumber(Mid([shipment-date],6,2)),
    ToNumber(Mid([shipment-date],9,2)));

    var TimeOfDay TimePart = ToTimeOfDay(Mid([shipment-date],12,5));

    ToTimestamp($DatePart, $TimePart )
  • Thanks for the great help

    It's really appreciate, it was a big help

    Thanks