473,408 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

STCK to DateTime type conversion

I have a client program that talks to an IBM mainframe and recieves
64bit unsigned integers(STCK) that represent date-time values. I need to
convert these to native DateTime format for use in my c# code. There
appears to be a convert function that takes a long parameter and returns
a DateTime but not a ulong. Anyone have or know of any conversion
routines available for this purpose. If not I'll have to write my own.
Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 1940
Daniel,

I would use the BitConverter class, getting the bytes, and then passing
the bytes back, calling the ToInt64 method. Once you have that, you can
pass the long to the appropriate method on the DateTime class to convert the
long into a DateTime.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel Stoever" <ds******@seevse.com> wrote in message
news:eZ*************@tk2msftngp13.phx.gbl...
I have a client program that talks to an IBM mainframe and recieves
64bit unsigned integers(STCK) that represent date-time values. I need to
convert these to native DateTime format for use in my c# code. There
appears to be a convert function that takes a long parameter and returns
a DateTime but not a ulong. Anyone have or know of any conversion
routines available for this purpose. If not I'll have to write my own.
Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2

"Nicholas Paldino [.NET/C# MVP]" wrote...
I would use the BitConverter class, getting the bytes,
and then passing the bytes back, calling the ToInt64
method. Once you have that, you can pass the long to
the appropriate method on the DateTime class to convert
the long into a DateTime.


I don't think that would be necessary, or enough for that matter...

If the OP already have a .NET-client talking to the IBM mainframe, the
actual "transportation" of the ulong would be the least problem.

The ToDateTime in Convert that takes a long seems to be "not implemented
yet"...

And, the constructor in the DateTime struct that takes a long is supposed to
take the number of "ticks" (100-nanoseconds since 0001-01-01 12:00 AM),
which probably is *not* what an STCK looks like...

In one place I've seen an STCK defined as the number of milliseconds since
1900-01-01 something...

I've also seen another definition of STCK as the first 32 bits representing
the Date, while the latter 32 bits representing a fraction of a day, hence
the time part...

So, if you look up what the STCK really looks like on your IBM, and share
that with us, we could possibly come up with some simple way to convert it
to the correct DateTime.

just my 2c

// Bjorn A


Nov 16 '05 #3

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

Similar topics

3
by: Keith | last post by:
I am fairly new to SQL so sorry if this is a really dumb question. I have a small (still) SQL database, which I am trying to query from an ASP page. The field I am querying is of DATETIME data...
3
by: Christopher Crooker | last post by:
We had a function with the signature: Function(Object *, DateTime, DateTime, EnumType) and then changed the class some and there was a 4 parameter function with the signature: ...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
11
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
12
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
11
by: Tim | last post by:
Hi, I am trying to do something simple. Convert a string date to datetime but it is not working and is giving me a baffling error! System.Convert.ToDateTime("Jan 30, 2006")...
9
by: Hrvoje Voda | last post by:
How to convert text from textbox "12.05.1977" into "12/05/1977"? and also check if the text is in right format before converting? Hrcko
1
Manikgisl
by: Manikgisl | last post by:
But the problem is we have dates in Varchar instead Datetime While Converting Varchar To Datetime All four formats are unable to Convert ie select Convert(Datetime,'18-11-2008 2:35:19...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.