🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #137376

[XNews] Date conversion error

#137376
From: Nicholas Ring
Date: Wed, 12 Nov 2003 21:11
39 lines
2056 bytes
Luu,

There is a bug with the routine that converts the date within the score 
file. If the user changes the date seperator within Windows, the string 
to date conversion fails.

If it is what I think it is (as I have came across a similar bug with the 
application I am writing in Delphi), what is needed is when converting 
from string to date is something like the following:

  DTFormat := ShortDateFormat;
  DSFormat := DateSeparator;
  try
    ShortDateFormat := 'dd/mm/yyyy';
    DateSeparator := '/';

    // <do your conversion here>

  finally
    ShortDateFormat := DTFormat;
    DateSeparator := DSFormat;
  end;

Of course this means that the date has to be in the specified format, so 
when writing the date out, similar technique needs to be done:

  DSFormat := DateSeparator;
  try
    DateSeparator := '/';

    var := FormatDateTime('dd/mm/yyyy', <date_to_convert>);

  finally
    DateSeparator := DSFormat;
  end;


Hope this helps,
Nick
Technical Details
Message-ID: <Xns9432532577EFENickForAlison@203.50.2.94>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.moat.net!ken-transit.news.telstra.net!news.telstra.net!lon-spool.news.telstra.net!203.50.2.94.MISMATCH!reader.news.telstra.net!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <Xns9432532577EFENickForAlison@203.50.2.94>
Subject: [XNews] Date conversion error
Date: Wed, 12 Nov 2003 21:11:26 +0000
From: Nicholas Ring <Nicholas.Ring@NOSPAM.smf.com.au>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.moat.net!ken-transit.news.telstra.net!news.telstra.net!lon-spool.news.telstra.net!203.50.2.94.MISMATCH!reader.news.telstra.net!not-for-mail
Newsgroups: news.software.readers
Organization: SMF Funds Management
User-Agent: Xnews/06.07.17
Lines: 39
NNTP-Posting-Host: 203.47.115.45
X-Trace: 1068671486 lon-reader.news.telstra.net 31743 203.47.115.45