Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Excel date functions (Any)

    Looking for dates...

    with that provocative lead-in, I'm actually looking for code that does what is built into Excel as far as date functions. This is for our web site. It could be in VB/VBA and we'll convert, or PERL, which is what we use. I'd like to be able to take a string, check that it is a valid date, and convert it to a serial number (base doesn't have to be 1/1/1900). Would like to be able to then add/subtract days from the number (that's simple). Would like to be able to convert serial numbers into year, day, month, weekday. Don't need time functions.

    I decided to post to here rather than VB/VBA Board but cross-posting by moderator couldn't hurt.

    TIA

    Fred

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Excel date functions (Any)

    VBA does implict date conversions, so if you use US date conventions VBA date manipulations can be easy. The VBA function ISDATE(expression) will return a Boolean indicating if it can or cannot convert 'expression' to a date or date and time, you can use Type Conversion functions CDate(expression) to convert data to dates, CDbl(expression) to convert a date-&-time to a numeric value, and CInt(expression) to convert an integer date only to a number. See also the Format and Date functions in VBA. There are a few odd threads in the VBA Forum about date manipulations, and look for <!post=MACROPODS Star Post,249902>MACROPODS Star Post<!/post> in Word on date arithmetic where you'll find excellent code.

    Hope this gets you started.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Excel date functions (Any)

    John,

    Thanks for the response.

    Maybe I should not have mentioned VB/VBA because of the built-in conversions, which I forgot.

    Again, our web master has written code for manipulating dates (that might be part of a filename) in PERL. She takes apart the date, month, year for the filename and adds x days (which can be difficult), does the same for "today", aand then compares year-today to year-filename, month-today to month-filename, etc.

    So we're looking for some general code that provides the functionality of excel in terms of date BIF (don't need time).

    [add]
    I'm a little familiar with Macropod's post. Looked at his index and not sure I see what I need. I also know from other posts on that thread that this would not be the way to code things in a programming language but uses what's available in word w/o resorting to any VBA.

    Thanks.

    Fred

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Excel date functions (Any)

    Is this Perl Date and Time functions resource webpage of use?
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Excel date functions (Any)

    John,

    Thanks. I looked at the link and it looks promising. Of course, I know little about PERL. I'll send over to our webmaster and let her see if it helps.

    Fred

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •