Author Topic: text field with a day counter or "Return by Date"  (Read 1423 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 230
text field with a day counter or "Return by Date"
« on: September 08, 2021, 05:11:39 PM »
I have a stamp with a date in it. The user fills out the date the drawing should be returned, which is always +14 days from when they inserted the stamp & published the drawing. I'd like to create a field that reads todays date and add 14 days to it. Does anyone know if this is possible in a text field?

In excel it would be "=(TODAY()+14)". I just don't know of a diesel equivalent.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

Lee Mac

  • Seagull
  • Posts: 12549
  • London, England
Re: text field with a day counter or "Return by Date"
« Reply #1 on: September 08, 2021, 05:41:34 PM »
Try the following DIESEL expression (change the formatting to suit):
Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),"dd mon yyyy")

jlogan02

  • Bull Frog
  • Posts: 230
Re: text field with a day counter or "Return by Date"
« Reply #2 on: September 08, 2021, 06:05:12 PM »
Try the following DIESEL expression (change the formatting to suit):
Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),"dd mon yyyy")

Code - Auto/Visual Lisp: [Select]
  1. $(+, $(edtime, $(getvar,date), 14)
I had tried this while waiting and got nowhere.

Will try your method.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 230
Re: text field with a day counter or "Return by Date"
« Reply #3 on: September 08, 2021, 06:12:45 PM »
Not quite the result I was expecting. I edited to this...

Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),"MM-DD-yyyy")

With the intention of getting a 09-22-2021 result. However, my result turned out to be 10-22-2021
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9769
Re: text field with a day counter or "Return by Date"
« Reply #4 on: September 08, 2021, 07:45:36 PM »
Not quite the result I was expecting. I edited to this...

Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),"MM-DD-yyyy")

With the intention of getting a 09-22-2021 result. However, my result turned out to be 10-22-2021

I think you want:
Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),MO-DD-YYYY)
  2.  
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

jlogan02

  • Bull Frog
  • Posts: 230
Re: text field with a day counter or "Return by Date"
« Reply #5 on: September 09, 2021, 04:12:21 PM »


I think you want:
Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),MO-DD-YYYY)
  2.  
[/quote]

Giving it a shot. Will let you know tomorrow.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

Lee Mac

  • Seagull
  • Posts: 12549
  • London, England
Re: text field with a day counter or "Return by Date"
« Reply #6 on: September 10, 2021, 01:49:09 PM »
Not quite the result I was expecting. I edited to this...

Code - Auto/Visual Lisp: [Select]
  1. $(edtime,$(+,$(getvar,date),14),"MM-DD-yyyy")

With the intention of getting a 09-22-2021 result. However, my result turned out to be 10-22-2021

I would suggest consulting the documentation for the DIESEL edtime function in order to understand the appropriate value to use for the picture argument. As noted in the documentation, "MM" will yield the number of minutes.

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9769
Re: text field with a day counter or "Return by Date"
« Reply #7 on: September 10, 2021, 01:56:05 PM »
Do not wrap your MO-DD-YYYY in quotes.

Quote
<snip>The following example uses the date and time from the preceding table. Notice that the comma must be enclosed in quotation marks because it is read as an argument separator.
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

jlogan02

  • Bull Frog
  • Posts: 230
Re: text field with a day counter or "Return by Date"
« Reply #8 on: September 10, 2021, 06:31:24 PM »
I would suggest consulting the documentation for the DIESEL edtime function in order to understand the appropriate value to use for the picture argument. As noted in the documentation, "MM" will yield the number of minutes.

My bad, I was looking at this.

Do not wrap your MO-DD-YYYY in quotes.

Quote
<snip>The following example uses the date and time from the preceding table. Notice that the comma must be enclosed in quotation marks because it is read as an argument separator.

Understood.

Thanks to both of you. I'll check my results Monday.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10