View previous topic :: View next topic
|
Author |
Message |
purushottam
New User
Joined: 26 Feb 2007 Posts: 37 Location: pune
|
|
|
|
how to pass value of numeric variable of length 14 to timestamp variable
eg: - I want to move this 16011414343494 value to timestamp variable |
|
Back to top |
|
|
purushottam
New User
Joined: 26 Feb 2007 Posts: 37 Location: pune
|
|
|
|
from timestamp variable of TYPE T
16 : Year
01 : Month
14 : Day
14 : Hour
34 : Minutes
34 : Seconds
94 : milliseconds |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
You can set a time variable using a time literal, but it's accurate only to the second.
Code: |
ASSIGN #T = E'2016-01-14 14:34:34' |
ps The term TIMESTAMP is reserved for the system's STORCLOCK value (format B8). |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
timestamp is also a DB2 term and in the format of
2016-01-15-07.37.08.724517 |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
Purushottam,
If your value is in a variable, then you can use MOVE EDITED for the conversion of alpha to T format.
Code: |
DEFINE DATA LOCAL
1 #A (A14) INIT <'16011414343494'>
1 #T (T)
END-DEFINE
MOVE EDITED #A TO #T (EM=YYMMDDHHIISS)
DISPLAY #A #T (EM=YYYY/MM/DD^HH:II:SS)
END |
Code: |
Page 1 01/15/16 12:21:14
#A #T
-------------- -------------------
16011414343494 2016/01/14 14:34:34 |
|
|
Back to top |
|
|
|