Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Minor defense of VBScript's date handling

by dze27 (Pilgrim)
on Aug 28, 2001 at 21:19 UTC ( #108512=note: print w/replies, xml ) Need Help??

in reply to 'use strict' is not Perl

A little offtopic, but how does VBScript mangle dates silently? I use VBScript regularly (I'm afraid perl is verboten for our production web site, I just use it for behind-the-scenes scripting) and I don't recall many surprises. The odd problem I've had has come when specifying a 6-digit date, if that's what you mean. Sometimes, depending on the locale setting on the server it may do something unanticipated to a yy-mm-dd or mm-dd-yy or dd-mm-yy date. Of course now we're in 2001 the two-digit year could be mistaken for a month or day. What I do is to always use yyyy-mm-dd format when specifying a date and let VB's internal format take care of everything. This way you don't run into any problems. Then use DateDiff, DateAdd, Year, Month, Day etc. to get all of what you need. Maybe I'm missing something, but I've found VBScript's date handling very convenient.

  • Comment on Minor defense of VBScript's date handling

Replies are listed 'Best First'.
Re: Minor defense of VBScript's date handling
by inverse (Acolyte) on Aug 28, 2001 at 21:41 UTC
    If your date format is the american style mm-dd-yy and you pass VB a string with mm > 12 it will not complain like it should. It just silently assumes you mean dd-mm-yy.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://108512]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2021-10-20 09:16 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (79 votes). Check out past polls.