Re: string manipulation experts...

From: Dr John Stockton (spam_at_merlyn.demon.co.uk)
Date: 09/24/04


Date: Fri, 24 Sep 2004 18:39:43 +0100

JRS: In article <#Rml0sXoEHA.3876@TK2MSFTNGP15.phx.gbl>, dated Thu, 23
Sep 2004 10:39:58, seen in news:microsoft.public.scripting.vbscript,
Phil Strack <philstrack@hotmail.com> posted :

>I've inherited a production system that spits out logs that are named
><AppName><Date>.log and <AppName>stdError<Date>.log where
>AppName is the text name of the application
>Date is in the format YYYYmd
>and stdError is literal. (examples: application2004923.log,
>applicationstdError2004923.log)

That is very silly. Does 2004123 represent December 3rd or January
23rd?

>The new naming convention is AppName-<Date>.log and AppName-<Date>-Err.log
>where date is in the format: mmddyyyy. (examples: application-09232004.log,
>application-09232004-Err.log)

That is also silly; you should follow FIPS 4.4 & ISO 8601. Your
predecessor tried to do likewise, but blundered. Use YYYYMMDD (or YYYY-
MM-DD). YYYYMMDD is unambiguous everywhere, and can be sorted as a
string.

YYYYMMDD is easily obtained, for years in 1000 to 9999; let D be a
CDate, form (Year(D)*100 + Month(D))*100 + Day(D) which gives a
number in the range 10000101 to 99991231, and use the default conversion
to string. Note that the unaided method fails for mmddyyyy; for that,
you can use the rightmost 8 characters of 1E8 + (M*100+D)*10000+Y.
 

-- 
 © John Stockton, Surrey, UK.  ?@merlyn.demon.co.uk   Turnpike v4.00   IE 4 ©
 <URL:http://www.jibbering.com/faq/>  JL/RC: FAQ of news:comp.lang.javascript 
  <URL:http://www.merlyn.demon.co.uk/vb-dates.htm> VB dates, maths, sources.
 <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.


Relevant Pages

  • Re: string manipulation experts...
    ... >>I've inherited a production system that spits out logs that are named ... >>AppName is the text name of the application ... Use YYYYMMDD (or YYYY- ... > to string. ...
    (microsoft.public.scripting.vbscript)
  • Re: Is it possible to convert ISO date format?
    ... Of course you could refine the pattern for also approximatively ... validating the input string to match YYYYMMDD-format. ... YYYYMMDD into three digit-string fields ... Dim s, dateIso, dateVal ...
    (microsoft.public.scripting.vbscript)
  • Re: Saving results
    ... "Bruce J. Weimer" writes: ... A string containing the date of today formated as YYYYMMDD ... A string containing a serial number formated as YYYYMMDDSS. ... (WITH-OPEN-FILE (SDF FILE ...
    (comp.lang.lisp)
  • Re: Problem with dates,store procedure and ado
    ... CONVERT with 102 style expects the date string as 'mm/dd/yyyy' while you're ... convert a 'yyyymmdd' string to a date for you. ... >> then try to add SET NOCOUNT ON as a very first statement in your SP. ...
    (microsoft.public.data.ado)