Re: Timestamp to a string



Sandeep wrote:

Tom Leylan wrote:
People seem to be interpreting your question as "how do create and
concatenate a date string" which I think we can see it isn't.  Your main
problem (it seems to me) is to recognize whether there is a date on the
filename presently.  You have to derive a function to test for the presence
of a date which doesn't mistake some legitimate filename for your
concatenated string.

It isn't hard to do but you should isolate it into a single method
IsDatePresent() or something like that so you can adjust the code if you get
a false positive at some point.  You know it should be attached to the end
of the filename, it should follow a 99-99-9999 convention and the filename
cannot be shorter than 11 characters or there couldn't be a date string
attached (it had to have at least  one character initially).


I Think you are the closest to my problem. To add to what I already
wrote, I want to give an option of specifying the timestamp format to
the user and append the timestamp to it if any formatting is present.
So the format can be "MM-DD-YYYY" or "MM-DD-YYYY 0.0.0" or any format
that is supported by "DateFormat" class. Looks like there is no direct
function which can do this - and writing a custom function to check for
all such cases would be very difficult ... I probably would restrict
the number of formats that can be specified.

Sandeep


How do you intend to capture the format required? Is it going to be a free-hand entry or a series of options on the screen with different pre-defined formats available?
.




Relevant Pages

  • Re: Timestamp to a string
    ... > concatenate a date string" which I think we can see it isn't. ... > of a date which doesn't mistake some legitimate filename for your ... I want to give an option of specifying the timestamp format to ...
    (comp.lang.java.programmer)
  • Re: move part of a string
    ... filename. ... The problem is that the date formats are all different. ... I thought of checking the string for numbers but that won't work. ... you have the date in "proper" form, you could use the Format function to ...
    (microsoft.public.vb.general.discussion)
  • move part of a string
    ... I have a rather complicated problem. ... filename. ... The problem is that the date formats are all different. ... I thought of checking the string for numbers but that won't work. ...
    (microsoft.public.vb.general.discussion)
  • file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)