Fighting with TimeStamp...

  • Thread starter Thread starter robert0
  • Start date Start date
R

robert0

Hi,
i get these values from an Access database:
Time="25135000"
Date='"731715"

Please, how can i convert them in a readable date?I didn't find any working
function in help on line.
Thanks.
 
Hi,
i get these values from an Access database:
Time="25135000"
Date='"731715"

Please, how can i convert them in a readable date?I didn't find
any working function in help on line.
Thanks.

robert0,

How are you getting these values from the database? Can you post
some example code?

What are the data types of these columns?


Chris.
 
robert0,

How are you getting these values from the database? Can you post
some example code?

What are the data types of these columns?


Chris.
Hi,
thanks for your reply.


Well ,are string types in database, but i'm sure they are timestamps because
another program running (which i'm trying to enhance) shows datetime instead
of timestamps.
 
Sorry for second post but i forgot this:


this is the way delphi7 solves the problem:

stamp.Time:= myTime;
stamp.Date:=myDate;
newdate:= TimeStampToDateTime(stamp);

where myTime and myDate are the strings Time="25135000" and Date='"731715
Any idea to port this to C#?
Bye.
 
Sorry for second post but i forgot this:


this is the way delphi7 solves the problem:

stamp.Time:= myTime;
stamp.Date:=myDate;
newdate:= TimeStampToDateTime(stamp);

where myTime and myDate are the strings Time="25135000" and
Date='"731715 Any idea to port this to C#?
Bye.

robert0,

According to the Delphi help entry for TimeStampToDateTime:

"...the date is the number of calendar days since the start of the
current calendar (that is, January 1, 0001 would have a value of 1),
and time is the number of milliseconds since midnight."

So simply adding the days and milliseconds to a System.DateTime might
work:

public DateTime GetDateTimeFromTimeStamp(int days, int time)
{
return new DateTime(1, 1, 1).AddDays(days).AddMilliseconds(time);
}
 
Back
Top