cdate?

Discussion in 'AutoCAD' started by Jason Wilder, May 26, 2004.

  1. Jason Wilder

    Jason Wilder Guest

    I think I've seen these before, but it's not coming up in my searches.
    Would someone mind posting a routine that will give me today's date (i.e.
    cdate) as a string (i.e. "5-25-2004" or the like)? I can't seem to find it
    in my inventory of handy routines.

    Thanks.
     
    Jason Wilder, May 26, 2004
    #1
  2. Jason Wilder

    Walt Engle Guest

    Cdate as a variable gives the following: 20040525.18353268
    You're probably going to have to invest time in a lsp routine to input it by
    keyboard.
     
    Walt Engle, May 26, 2004
    #2
  3. Jason Wilder

    OLD-CADaver Guest

    (setq dateandtime (menucmd "m=$(edtime, $(getvar, date),dd-mon-yy hh:mmam/pm)"))
     
    OLD-CADaver, May 26, 2004
    #3
  4. Jason Wilder

    Jason Wilder Guest

    I know. I had a routine at one time that would break down that sysvar and
    return date/time, but can't find it.

    I'm building a large routine and this is one piece that I'm missing. I was
    hoping someone wouldn't mind sharing their sub routine/function with me. :)
     
    Jason Wilder, May 26, 2004
    #4
  5. Jason Wilder

    Jeff Mishler Guest

    Here's one way:

    (setq datst (rtos (getvar "cdate") 2 0))
    (setq date-string
    (strcat
    (substr datst 5 2)
    "/"
    (substr datst 7 2)
    "/"
    (substr datst 1 4)
    )
    )

    Jeff
     
    Jeff Mishler, May 26, 2004
    #5
  6. Or:

    Command: (menucmd "M=$(edtime,$(getvar,DATE),M-DD-YYYY)")
    "5-25-2004"

    --
    R. Robert Bell


    Here's one way:

    (
     
    R. Robert Bell, May 26, 2004
    #6
  7. Jason Wilder

    Rudy Tovar Guest

    Ah what the heck, one more for the road...

    (defun C:CPLOT (/ Tag Yr Mo Da Day Time)

    (setq Tag (rtos (getvar "cdate") 2 6)
    Yr (substr Tag 1 4)
    Mo (substr Tag 5 2)
    Da (substr Tag 7 2)
    )

    (cond
    ((= Mo "01")(setq plot_Mo "01"))
    ((= Mo "02")(setq plot_Mo "02"))
    ((= Mo "03")(setq plot_Mo "03"))
    ((= Mo "04")(setq plot_Mo "04"))
    ((= Mo "05")(setq plot_Mo "05"))
    ((= Mo "06")(setq plot_Mo "06"))
    ((= Mo "07")(setq plot_Mo "07"))
    ((= Mo "08")(setq plot_Mo "08"))
    ((= Mo "09")(setq plot_Mo "09"))
    ((= Mo "10")(setq plot_Mo "10"))
    ((= Mo "11")(setq plot_Mo "11"))
    ((= Mo "12")(setq plot_Mo "12"))
    )


    (cond
    ((= Mo "01")(setq Mo "Jan"))
    ((= Mo "02")(setq Mo "Feb"))
    ((= Mo "03")(setq Mo "Mar"))
    ((= Mo "04")(setq Mo "Apr"))
    ((= Mo "05")(setq Mo "May"))
    ((= Mo "06")(setq Mo "Jun"))
    ((= Mo "07")(setq Mo "Jun"))
    ((= Mo "08")(setq Mo "Aug"))
    ((= Mo "09")(setq Mo "Sep"))
    ((= Mo "10")(setq Mo "Oct"))
    ((= Mo "11")(setq Mo "Nov"))
    ((= Mo "12")(setq Mo "Dec"))
    )

    (setq Day "M=$(edtime,$(getvar,date),DDDD)")
    (setq Day (menucmd Day))
    (setq Day (strcase Day))
    (cond
    ((= Day "MONDAY")(setq plot_Day "Mon"))
    ((= Day "TUESDAY")(setq plot_Day "Tue"))
    ((= Day "WEDNESDAY")(setq plot_Day "Wed"))
    ((= Day "THURSDAY")(setq plot_Day "Thu"))
    ((= Day "FRIDAY")(setq plot_Day "Fri"))
    ((= Day "SATURDAY")(setq plot_Day "Sat"))
    ((= Day "SUNDAY")(setq plot_Day "Sun"))
    )


    (setq time "M=$(edtime,$(getvar,date),H:MMam/pm)")
    (setq time (menucmd time))



    (setq Log_time (strcat Day ", " Mo " " Da ", " Yr " Time: " time))
    (princ log_time)
    (princ)

    )

    --

    AUTODESK
    Authorized Developer
    http://www.Cadentity.com
    MASi
     
    Rudy Tovar, May 26, 2004
    #7
  8. Jason Wilder

    Jason Wilder Guest

    Thanks all, appreciate it! Hopefully I'll have an opportunity to return the
    favor.
     
    Jason Wilder, May 26, 2004
    #8
  9. Jason Wilder

    Dale Fugier Guest

    If you have DOSLib and typed the following on the command line:

    (dos_cdate "%A, %B %d, %Y")

    You'd get the following string:

    "Thursday, March 27, 2004"

    You can download DOSLib free from www.mcneel.com.
     
    Dale Fugier, May 28, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...