🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
1 messages
1 total messages Started by Nicholas Ring Wed, 12 Nov 2003 21:11
[XNews] Date conversion error
#137376
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads