AutoCAD 2013/2014/2015

AutoCAD 2013/2014/2015

Reply
Active Member
copdahl
Posts: 7
Registered: ‎06-14-2010
Message 1 of 9 (454 Views)

Ordinal Date

454 Views, 8 Replies
04-07-2014 12:57 PM

Does anyone know if there is a way to format the date fields to display as an ordinal date? (ie. 21st of January, 2014)

Distinguished Contributor
REID7800
Posts: 182
Registered: ‎01-08-2010
Message 2 of 9 (437 Views)

Re: Ordinal Date

04-07-2014 02:22 PM in reply to: copdahl

you looking for  something like this?

%<\AcVar CreateDate \f "d of MMMM, yyyy">%

 

_____

Reid B.
_____
Acad 2015
Architecture 2010
Active Member
copdahl
Posts: 7
Registered: ‎06-14-2010
Message 3 of 9 (433 Views)

Re: Ordinal Date

04-07-2014 02:30 PM in reply to: REID7800
Not quite. I need the ordinal version of the date where the day is listed
as 1st, 2nd, 3rd, 4th etc. Any ideas for that?

--

*Chantelle Opdahl*

Survey CAD Drafter





*MISSION*

GEOSPATIAL

[p] 403.668.4604 [f] 403.668.4622

[e] copdahl@mGeo.ca *www.mGeo.ca*
3320 8th Street S.E., Calgary, Alberta T2G 5S7
Distinguished Contributor
REID7800
Posts: 182
Registered: ‎01-08-2010
Message 4 of 9 (409 Views)

Re: Ordinal Date

04-08-2014 05:45 AM in reply to: copdahl

If you want to go the lisp way, I CAN help you with that. If not, this is all that I know for fields (as far as date stamps are concerned)... Let me know

_____

Reid B.
_____
Acad 2015
Architecture 2010
Valued Mentor
AcadAdamLT
Posts: 494
Registered: ‎12-14-2010
Message 5 of 9 (397 Views)

Re: Ordinal Date

04-08-2014 06:28 AM in reply to: copdahl

None of the standard field date variables that suites you?

use the "Field" command and see the different formats for yourself.

Signature, sincerely... //Adam
AutoCad LT 2014
Give Kudos where credit is due, Mark "accepted as solution" if the post solved your question.
*Expert Elite*
hwalker
Posts: 1,237
Registered: ‎07-14-2004
Message 6 of 9 (391 Views)

Re: Ordinal Date

04-08-2014 06:42 AM in reply to: copdahl

That's when I turned 44.

 

Unfortunately there is no OOTB answer

 

You would have to write a lisp routine which would

 

1. Get the date

2. Check the last digit

3. Add the following text depending on the digit

1 = st

2 = nd

3 = rd

4 to 0 = th

Distinguished Contributor
REID7800
Posts: 182
Registered: ‎01-08-2010
Message 7 of 9 (387 Views)

Re: Ordinal Date

04-08-2014 06:53 AM in reply to: copdahl
(defun c:test ( / *error* date mtext pt )
  (vl-load-com)
  (defun *error* ( m )
    (or (wcmatch (strcase m) "*BREAK,*CANCEL*,*EXIT*")
         (princ (strcat "\n** Error: " m " **")))
    (princ)
  )

  (defun date ( / fixday d )
    (defun fixday ( str / n )
      (strcat (itoa (atoi str))
        (cond 
          ( (and (< 3 (setq n (atoi str)))(> 21 n)) "th" )
          ( (eq "1" (setq n (substr str (strlen str))))
            "st"
          )
          ( (eq "2" n) "nd")
          ( (eq "3" n) "rd")
          ( "th")
        )
      )
    )
  
    (strcat 
      (fixday 
        (substr (setq d (menucmd "M=$(edtime, $(getvar,date),MoDDYYYY)"))
          3 2
        )
      ) " of "
      (nth (1- (atoi (substr d 1 2)) )
        '("January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December")
      ) ", " (substr d 5)
    )
  )

  (defun mtext ( content height layer just insertionpoint flag / e )
    (setq e
      (entmakex
        (list
          (cons 0   "MTEXT")
          (cons 100 "AcDbEntity")
          (cons 67  0)
          (cons 8   layer)
          (cons 100 "AcDbMText")
          (cons 10  insertionpoint)
          (cons 40  height)
          (cons 71  just) 
          (cons 72  5) 
          (cons 1   content)
          (cons 7   (getvar 'textstyle)) 
          (cons 11  (list 1.0 0.0 0.0))
          (cons 90 3)
          (cons 63 256)
          (cons 45 1.1)
  	  (cons 441 0)
        )
      )
    )
    (if (and e flag)
      (vlax-ename->vla-object e) e
    )
  )

  (if 
    (setq pt (getpoint "\nSpecify insertion point of Date: "))
    (progn
      (mtext (date) (getvar 'textsize)(getvar 'clayer) actopleft pt nil)
    )
  ) (princ)
)

 I couldn't resist! :smileyhappy:

_____

Reid B.
_____
Acad 2015
Architecture 2010
Valued Mentor
AcadAdamLT
Posts: 494
Registered: ‎12-14-2010
Message 8 of 9 (359 Views)

Re: Ordinal Date

04-08-2014 07:57 AM in reply to: REID7800

Haha gotta love the entusiasm :smileyhappy:

Signature, sincerely... //Adam
AutoCad LT 2014
Give Kudos where credit is due, Mark "accepted as solution" if the post solved your question.
Distinguished Contributor
REID7800
Posts: 182
Registered: ‎01-08-2010
Message 9 of 9 (346 Views)

Re: Ordinal Date

04-08-2014 08:57 AM in reply to: AcadAdamLT

I noticed you're an LT user... here ya go!

_____

Reid B.
_____
Acad 2015
Architecture 2010
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.