× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Eric,

Scott Klements routine comes here:

*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Unix2Rpg(): Convert Unix timestamp -> RPG timestamp
*
* UnixTime = (input) timestamp in Unix format
* (seconds from epoch. UTC)
* Returns the RPG timestamp
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

P Unix2Rpg B export
D PI z
d UnixTime 10u 0 value
*
d CEEUTCO PR
d Hours 10i 0
d Mins 10i 0
d Secs 8f
d fc 12a options(*omit)

d EPOCH c z'1970-01-01-00.00.00'

d offset s 10i 0 static inz(-1)
d Hours s 10i 0 static
d Mins s 10i 0 static
d Secs s 8f static

d retval s z

/free

if (offset = -1);
CEEUTCO(Hours: Mins: Secs: *omit);
offset = secs;
endif;

retval = EPOCH
+ %seconds(UnixTime)
+ %seconds(offset);

return retval;

/end-free
P Unix2Rpg E

Please excuse the bad format.

Best regards

Jan
Am 03.08.2015 um 17:24 schrieb Eric Hill:
Jan,

Thanks for the link but every time I go there I just get redirected to iProdeveloper's main page. Even when I click on the "Forums" link I cannot get to the forum.

Eric Hill
Integrated Corporate Solutions
ehill@xxxxxxxxxxxxx
256-760-8239

NOTICE:
This message may contain privileged or otherwise confidential information.
If you are not the intended recipient, please immediately advise the sender
by reply e-mail and delete the message and any attachments without using,
copying or disclosing the contents.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jan Grove Vejlstrup
Sent: Monday, August 03, 2015 9:44 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: ***SPAM*** Re: Converting Data
Importance: Low

Hello Eric

The timestamp that you receive is in unix-format. Scott Klement has a routine that converts the unix-timestamp to a RPG-timestamp in this thread:

http://forums.iprodeveloper.com/forums/aft/147649

Best regards

Jan

Am 03.08.2015 um 16:25 schrieb Eric Hill:
Rob,

Thanks for the quick reply. Here are the debug results:

ST_MTIME INT(10) 1437659037 '55B0EF9D'X
DATEBIN INT(10) 1437659037 '55B0EF9D'X
DATEDTS CHAR(8) 'í^Õ¸ ' '55B0EF9D40404040'X

Eric Hill
Integrated Corporate Solutions
ehill@xxxxxxxxxxxxx
256-760-8239

NOTICE:
This message may contain privileged or otherwise confidential information.
If you are not the intended recipient, please immediately advise the
sender by reply e-mail and delete the message and any attachments
without using, copying or disclosing the contents.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
rob@xxxxxxxxx
Sent: Monday, August 03, 2015 9:10 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Converting Data

If you run this in debug (or DSPLY DATEBIN) what is it's value? If that looks good then your data structure is bad.
You could specify:
ctl-opt debug(*yes);
and then add
dump;
right after the
DateBin = st_mtime;

You should see something for DATEDTS similar to this line:
MYCHAR CHAR(5) 'HI ' 'C8C9404040'X

Show us that whole line, including the hex value.


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: Eric Hill <ehill@xxxxxxxxxxxxx>
To: "rpg400-l@xxxxxxxxxxxx" <rpg400-l@xxxxxxxxxxxx>
Date: 08/03/2015 09:57 AM
Subject: Converting Data
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



I am reading in a file from the IFS and I am wanting to get the
modification date and time. I am using Scott Klement's copybooks and
I know the field to use is st_mtime. I understand this field is in
*DTS format so I am going to convert it using the QWCCVTDT API. This
API expects the input date to be in an 8 alpha field. The st_mtime
field is defined as 10i 0. I have a data structure in my program like this:

D DS
D DateDts 8a
D DateBin 10i 0 overlay(DateDts)

I then do this:

DateBin = st_mtime;

I get returned nothing close to the actual modification date and time
I see on the properties of the file in the IFS. It is showing
07/15/2015 whereas the returned date is 04/23/1976.

Trouble with my data structure?

Thanks in advance?

Eric Hill
Integrated Corporate Solutions

NOTICE:
This message may contain privileged or otherwise confidential information.
If you are not the intended recipient, please immediately advise the
sender by reply e-mail and delete the message and any attachments
without using, copying or disclosing the contents.


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.