Author Topic: Date formats  (Read 3572 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Date formats
« on: May 24, 2005, 04:20:53 PM »
Can someone enlighten me as to what type of date system this is and how to calculate which is older?



Thanks,

daron

  • Guest
Date formats
« Reply #1 on: May 24, 2005, 04:35:36 PM »
Autocad usually uses, Julian.

whdjr

  • Guest
Date formats
« Reply #2 on: May 24, 2005, 04:47:13 PM »
These are actually properties of files.

Ok...so how do you convert Julian date to 'regular date' or tell which is more current?

Crank

  • Water Moccasin
  • Posts: 1503
Date formats
« Reply #3 on: May 24, 2005, 05:01:45 PM »
The right is older, because <DateCreated> is lower (you can also use the variable TDCREATE).

This value is represented as a Modified Julian Date (MJD), which is the Julian day number and decimal fraction of a day in the format : <Julian day number>.<Decimal fraction of a day>

Code: [Select]
(setq s (getvar "DATE"))
(setq nth_second (* 3600.0 24.0 (- s (fix s))))
Vault Professional 2023     +     AEC Collection

whdjr

  • Guest
Date formats
« Reply #4 on: May 24, 2005, 08:39:48 PM »
Quote from: Crank
The right is older, because <DateCreated> is lower (you can also use the variable TDCREATE)...

Is this always true?  Can I bank on this being a fact all the time?

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Date formats
« Reply #5 on: May 25, 2005, 02:17:11 AM »
That's what I use:
Code: [Select]
;
; -- Function ConvJulianDate
; Convert julian date/time (also serial) to standard format.
; Arguments [Typ]:
;   Val = Julian date/time [REAL]
;   Mde = Conversion mode, eg. "MO/DD/YYYY H:MMam/pm" [STR] *)
; Return [Typ]:
;   > Formatted date/time [STR]
; Notes:
;   *) Details for mode see Diesel, edtime
;
(defun ConvJulianDate (Val Mde / TmpVal)
 (setq TmpVal (if (minusp (- Val 2415019.0)) (+ Val 2415019.0) Val))
 (menucmd (strcat "M=$(edtime," (rtos TmpVal) "," Mde ")"))
)
Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

whdjr

  • Guest
Date formats
« Reply #6 on: May 25, 2005, 02:56:17 PM »
Thanks for all your help Jürg.

One more question though,

If I retrieve a date from a file that is '36460.6', using your code i know the date to be '10/27/1999 2:24pm'.  
What would I need to do if I wanted to know if another date was within 12 hours of this time?

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Date formats
« Reply #7 on: May 26, 2005, 06:59:18 AM »
Hi Will

You're welcome :D
Quote from: whdjr
If I retrieve a date from a file that is '36460.6', using your code i know the date to be '10/27/1999 2:24pm'.  
What would I need to do if I wanted to know if another date was within 12 hours of this time?
That's an easy one:
Code: [Select]
(fix (* 24 (- FirstTime NextTime)))FirstTime and NextTime should be a Julian-type date...

Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

whdjr

  • Guest
Date formats
« Reply #8 on: May 26, 2005, 12:02:03 PM »
Well Jürg, I'mm sorry to say that the results I get mean absolutely nothing.  They don't equal the time difference.  Can you explain any of it for me?

whdjr

  • Guest
Date formats
« Reply #9 on: May 26, 2005, 02:45:40 PM »
I have Googled this to death and this is what I came up with.  '.5' represents 12 hours therefore this will tell me if my file is with a 12 hour window.
Code: [Select]
(cond
    ((< (- FirstTime NextTime) 0.5)(do this))
    ((this is True)(do this))
)

Thanks for the help Jürg

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Date formats
« Reply #10 on: May 26, 2005, 03:25:11 PM »
Hi Will

Glad to help... :D
May I've misunderstand your question, I was thinking you need the difference (in hours) between two julian dates...

Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18