On 6/19/2009 4:46:53 PM, Ted Green wrote:
>
> Date() outputs the date
> according to the Country code
> - e.g. 06/19/2009 in the US
> and presumable 19-06-2009 in Europe.
No. In Europe, the date format is either 19.06.2009 or 19/06/2009, depending on the country. (The latter should be avoided since it causes confusion with the US format.)
The date separator '-' should be reserved for ISO date format: 2009-06-19.
>
> That is fine in some cases,
> but nearly useless in macros
> which parse the output of the
> Date command, because a macro
> that works in the US will fail
> in Europe and vice versa.
That is why the date format should always be explicitly specified in the macro, if the macro is going to parse the date string.
>
> Date(NORMAL) outputs as
> 06-19-2009 which is very
> STRANGE as no one uses the
> format of month, dash, day, dash, year.
Date(NORMAL) uses whatever date separator has been specified in the configuration.
I believe the default date separator after installing Vedit is '-'.
Maybe the default should be changed to '/'.
But of course the user can change it.
>
> Therefore, I am thinking of
> changing Date(NORMAL) to
> either output as 19-06-2009 or
> as 06/19/2009. I prefer
> 06/19/2009 as VEDIT is a US
> program and that is normal in
> the US. :-)
There is no need to change that. I think it is logical that if the macro command does not specify date separator, the configured date separator will be used.
>
> I could implement e.g.
> Date(LEFT) to output the day
> on the left side, e.g.
> 19-06-2009.
That is already implemented: Date(BEGIN)
>
> I could also implement
> internal values:
>
> Date_Day - returns the day
> Date_Month - returns the month
> Date_Year - returns the year
Those would be useful to simplify things (although you can always parse the date string with macro commands. It is more important to implement features that can not be done with macro language.)
>
> Also, poorly documented is the existing Jdate():
>
> JDate() - Return Julian date for current date
> JDate("06/19/2009") date)
> Return Julian date for mm/dd/yyyy
> JDate("19-06-2009") date)
> Return Julian date for dd-mm-yyyy
JDate("06/19/2009") works, but JDate("19-06-2009") gives error "Bad parameter".
The correct syntax seems to be:
JDate("06/19/2009")
JDate("19.06.2009", BEGIN)
JDate("2009-06-19", REVERSE)
(The separator character can be anything, it is ignored.)
Hopefully these and the other non-documented commands will be added to documentation. I would have needed these a few times. The only Julian date I found was in the command File_Stamp_Date().
>
> VEDIT's Julian date is the
> number of days since
> 01-01-0001, calculating leap
> years depending upon whether
> the year is divisible by 4,100
> or 400. (It does not account
> for the calendar change of
> 1582 which dropped 10 days,
> but that was to compensate for
> the previous incorrect leap
> years.)
And, if I am not wrong, you can get weekday with
JDate() % 7
The returned value is weekday number, 0 = Sunday. So no need to use Zeller's congruence any more!
--
Pauli
|
|