Forum Discussion

MonicaBridges's avatar
MonicaBridges
Qrew Trainee
4 years ago

Converting Date to Text

I'm trying to create a field that combines an employee's alphanumeric id from one field, with the date in another field.  

I can't find a formula that will allow me to link a text field with a date field, but am wondering if I'm able to convert the date to text?

------------------------------
Monica Bridges
------------------------------
  • Yes, you can convert most field to text using the ToText function.

    for Example

    List(" ", [Employee ID], ToText(My Date Field]))

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • ChristopheVerho's avatar
      ChristopheVerho
      Qrew Trainee

      I tried this formula, but it does not simply change the date to a text field, but also removes the formatting of the datefield (show month as a name) and the general app date setting (DD-MM-YYYY).

      06-Jan-2025 is changed to 01-06-2025

      We are a European company and this is very confusing for our users as they will read it as the first of June instead of the sixth of January.

      Is there a way to avoid this and keep the formatting?

  • np,

     

    var date MyDate = [Ship Date]; // enter your field here

    var text YYYY = ToText(Year($MyDate));

    var text MM = PadLeft(ToText(Month($MyDate)), 2, "0");

    var text DD = PadLeft(ToText(Day($MyDate)), 2, "0");

    List("-", $DD, $MM, $YYYY)