We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12390
    • 39 Posts
    Hi, how can I make jot display the date as 10th, 31st, 3rd etc etc (ordinal suffix)?

    I’ve got the placeholder - [+comment.createdon:date=`%d %B %Y, %H:%M:%S`+]

    However that does 10, 31 etc only?
      • 33992 ☆ A M B ☆
      • 455 Posts
      [+comment.createdon:date=`%d`+] will print day in month,
      [+comment.createdon:date=`%d`+]
      [+comment.createdon:date=`%d`:gt=`10`:and:lt=`20`:then=`th`:else=`
      	[+phx:math=`[+comment.createdon:date=`%d`+]%10`:is=`0`:then=`th`+]
      	[+phx:math=`[+comment.createdon:date=`%d`+]%10`:is=`1`:then=`st`+]
      	[+phx:math=`[+comment.createdon:date=`%d`+]%10`:is=`2`:then=`nd`+]
      	[+phx:math=`[+comment.createdon:date=`%d`+]%10`:is=`3`:then=`rd`+]
      	[+phx:math=`[+comment.createdon:date=`%d`+]%10`:gt=`3`:then=`th`+]
      `+]
      

      first line prints day, second line checks 10-20 numbers which must have "th" and ...
      So output for today will be "11th".

        God loves me. 【ツ】


        MODX.ir (Persian Support)

        Boplo.ir/modx/ (Persian)
        • 33337
        • 3,975 Posts
        Very nice AHHP! smiley works like a charm.

        BTW: If someone is experiencing the white space between the date and suffix eg. 3 th, be sure to make the whole call in 1 line, it will solve it.
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 33992 ☆ A M B ☆
          • 455 Posts
          phx:ordinal is a phx modifier for this. grin
            God loves me. 【ツ】


            MODX.ir (Persian Support)

            Boplo.ir/modx/ (Persian)