473,803 Members | 3,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Paradox Date field to human readable format

Hi,

can somebody tell me how to convert the date from a Paradox .DB to human
readable format?

I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.

Thanks for your help,

Martin
Nov 17 '05 #1
5 2787
Martin,

Are you using a Data Provider for the DB? If so, then the provider
should be responsible for changing it into a DateTime (assuming the column
is analagous to it).

If not, what are you using to get at the database?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"mphanke" <mp*****@nospam .nospam> wrote in message
news:Ov******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

can somebody tell me how to convert the date from a Paradox .DB to human
readable format?

I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.

Thanks for your help,

Martin

Nov 17 '05 #2
Use the DateTime constructor which takes a long (Int64) as parameter.
Iam not sure wheather the date is the higher or the lower 32 bits but you
can try it.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"mphanke" <mp*****@nospam .nospam> schrieb im Newsbeitrag
news:Ov******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

can somebody tell me how to convert the date from a Paradox .DB to human
readable format?

I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.

Thanks for your help,

Martin

Nov 17 '05 #3
Hi,

since the application is to be installed on very old computers, I'm
bound to not using .NET . I'm reading the header and then parsing the file.

They are using some freaky representation of days since 1/1/1 (some type
of Julian date, but not really!) the dates I have are 1/1/100 which
corresponds to 36.160 and 5/4/1996 which is 728.783.

I just don't get how they are coding this stuff!?!?

Martin

cody wrote:
Use the DateTime constructor which takes a long (Int64) as parameter.
Iam not sure wheather the date is the higher or the lower 32 bits but you
can try it.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"mphanke" <mp*****@nospam .nospam> schrieb im Newsbeitrag
news:Ov******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

can somebody tell me how to convert the date from a Paradox .DB to human
readable format?

I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.

Thanks for your help,

Martin


Nov 17 '05 #4
Hi,

thanks to everybody for the support. I figured out how to do this stuff.
It's a bit tricky but this snippet should do the conversion:

(- {BTW I know it is ugly coding =;-P}
This code is provided as is and comes with no guaranty what so ever!
Feel free to avoid the pain I had by using this snippet.
-)

Thanks,

Martin

int isLeap(int year)
{
return ((year % 4) == 0 && ((year % 100) != 0 || (year % 400)==0));
}

void ConvertDate(lon g days, int &day, int &month, int &year)
{
long _days;
int yearlengths[] = {365,366};
int length[2][12];

length[1][0] = length[0][0] = 31;
length[0][1] = 28;
length[1][1] = 29;
length[1][2] = length[0][2] = 31;
length[1][3] = length[0][3] = 30;
length[1][4] = length[0][4] = 31;
length[1][5] = length[0][5] = 30;
length[1][6] = length[0][6] = 31;
length[1][7] = length[0][7] = 31;
length[1][8] = length[0][8] = 30;
length[1][9] = length[0][9] = 31;
length[1][10] = length[0][10] = 30;
length[1][11] = length[0][11] = 31;

_days = days & 0x7fffffff ;
_days--;
year = 1;

int *len;
int leap = 0;

while(_days<0 || _days >= yearlengths[leap = isLeap(year)])
{
int nyear = year + _days/365;

if(_days < 0)
{
nyear--;
}

_days -= (nyear - year)*365 + ((nyear-1)/4 - (nyear-1)/100 +
(nyear-1)/400) -
((year-1)/4 - (year-1)/100 + (year-1)/400);
year = nyear;
}

len = length[leap];

for(month = 0; _days >= len[month]; month++)
{
_days -= len[month];
}

month++;

_days++;

day = _days;
}
mphanke wrote:
Hi,

can somebody tell me how to convert the date from a Paradox .DB to human
readable format?

I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.

Thanks for your help,

Martin

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
36226
by: Roy Riddex | last post by:
How do I add to a date? I thought the following code would work but it doesn't like it. I'm trying to add 6 months (182 days) onto a date. Option Explicit Private Sub Form_Load() Dim Answer As Integer Dim GivenDate As Date GivenDate = "2/1/2004" Answer = GivenDate + 182
4
11366
by: TonyMontana | last post by:
Hello, I've the following problem. I've to read out the data of a custom application. I think (I'm not sure) this application is using a Paradox DB to store it's information. I don't know it exactly cause I'm not familar with paradox at all, but I've found files like *.db, *.mb, *.px, *.xg*, *.yg* !!! I need the infomation from this files to combine it with other data stored in SQL 2000. I'm tried DTS to import the Data but I've got an...
3
14615
by: andrew | last post by:
Hi: I am already using TreeMap to massage records in my export file such that each record has a unique key combination ( LastName + FirstName + Member Key) . Thus I am sorting the records by the unique key. I also have a Date String Field in my record ( ie "30-Apr-2005" ). I want to create a unique key combination of ( LastName + FirstName + Member Key + Date). Can you please tell me what are the steps I need to do to sort the Date
3
3502
by: Marius Rus | last post by:
We have to write into an Paradox db that we manage to do. Unfortunatelly it is a field named "Date" of type Date/Time that we cannot write. If the field it is named as for example "Due_Date" of the same type Date/Time it is writing without any problem. Could provide some help please? Thank you.
15
9078
by: JenHu | last post by:
Hi expert, I have a data field (birthdate) contains a datetime datatype (mm/dd/yyyy), how can I convert to mmdd?? say, the birthday is 8/1/1979 and convert to mmdd DOB = DS.Tables("AcctInfoTble").Rows(3)("BRTHDATE") strResult.Insert(12, DOB.PadLeft(37, " ")) ---------------------------------------------------------------------------------------------------
6
1964
by: Trekmp | last post by:
I currently work in ASP and am in the process of moving some application across to PHP. At present I store dates in a database in numerical format 38694, which is 08/12/2005. In ASP its very easy to convert this value back into a date, but I cannot find a way to do this in PHP. Thanks for any help
2
7072
by: TofuTheGreat | last post by:
I'm using "Now.ToOADate" for a record timestamp in a small database app (it's what I want to do so don't try to disuade me ;-D). Anyway. I store the value of Now.ToOADate in a string field in the database (16 character field on a SQL server to be exact). Is there a way of converting the text value from that field back into a readable date/time? For example if a date is stored in the 16 character field as the OLE Automation format...
6
1896
by: Mark | last post by:
Hi, i have an application which works with date. The regional settings of the computer (XP prof. dutch version) are set to French (Belgium). Asp.net and Sql server take the short date format of the regional settings (e.g. 2/08/2007 or 13/08/2007). I checked both: that's ok. When i try to insert a date in a datetime field in sql server which is e.g.
10
2551
by: Jes | last post by:
Dear all I have a date field on a HTML form where the user is asked to key in dd/mm/yyyy However, when that is written to MySql it is either not accepted or another value is tored in the database. Is there any way to change value of this field back to yyyymmdd format as accepted correctly in sql. ? The change should preferably be when user click on submit.
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.