1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

@DATECONV[]

Discussion in 'Support' started by dcantor, Oct 9, 2009.

  1. dcantor

    Joined:
    May 29, 2008
    Messages:
    505
    Likes Received:
    3
    @DATECONV currently converts from the default format to the specified format.

    Shouldn't there be an input format specifier as well as an result form specifier? Without one, how would one convert, for example, from format 2 to format 5 on a system whose default is format 1?

    Suppose I read a date as 01-02-03 from a file known to be in format 2, but I want in ISO weekday format (5). The correct result is 2003-W05-6, but trying this on a system with default format 1 produces 2003-W01-4.

    Rex, please consider adding an optional third parameter to indicate the INPUT format, if different from the system's default.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    Definitely NITV; I'll add it to the suggestion list for a future version.

    @DATECONV assumes that the first argument is either an understandable format (i.e., ISO) or that it's in the default format. @DATECONV isn't intended to do random date conversions. Nobody's ever asked for that before -- do you have an actual need for it?
     
  3. dcantor

    Joined:
    May 29, 2008
    Messages:
    505
    Likes Received:
    3
    Yes, my actual need is almost exactly what I described. Well, I guess, since I have a work-around, it's an actual use rather than an actual need. I have a file that has format 2 dates and I need to convert them to format 4 dates, and my system default is format 1.
    (In my original example, I proposed format 5.) What I do now is
    Code:
    set outstring=%@makedate[%@date[%instring,2],4]
    
    What I'd prefer is
    set outstring=%@dateconv[%instring,2,4]

    Thanks for adding to the wish list for v12.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    rconn wrote:
    || Definitely NITV; I'll add it to the suggestion list for a future
    || version.
    ||
    || @DATECONV assumes that the first argument is either an
    || understandable format (i.e., ISO) or that it's in the default
    || format. @DATECONV isn't intended to do random date conversions.
    || Nobody's ever asked for that before -- do you have an actual need
    || for it?

    I do - when my program reads a report prepared in a format chosen by another
    program.

    I actually would also like an environment function (I do have a UDF, but its
    cumbersome and slow) to convert from AM/PM to 24-h format while retaining
    24-h format the default.
    --
    Steve
     

Share This Page