Hi,
Can anyone help me to resolve this?
I'm receiving the timestamp value. It is in format of 24hrs. I need to convert to 12 hrs format.
Eg:Input: 2005-01-01 00:00:00.000000
Output:2005-01-01 12:00:00 AM
Thanks,
Timestamp format- 24 hrs to 12 hrs
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 75
- Joined: Mon Jul 12, 2010 4:11 am
- Location: Chennai
Timestamp format- 24 hrs to 12 hrs
Ajitha S
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
First question - are you really receiving timestamps (from a database) or are your receiving strings containing timestamps (from a text file)? Your answer to that question will affect the answer that we can give for your original question.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 75
- Joined: Mon Jul 12, 2010 4:11 am
- Location: Chennai
As you said, your source is Database then you would handle at Source itself. Check for appropriate timestamp mask in Database flavours. For example Refer the below queries (Oralce).
SQL> select sysdate from dual;
SYSDATE
-------------------
2011-02-07 14:32:51
SQL> select to_char(sysdate,'yyyy-mm-dd hh:mi:ss AM') from dual;
TO_CHAR(SYSDATE,'YYYY-
----------------------
2011-02-07 02:32:56 PM
SQL> select sysdate from dual;
SYSDATE
-------------------
2011-02-07 14:32:51
SQL> select to_char(sysdate,'yyyy-mm-dd hh:mi:ss AM') from dual;
TO_CHAR(SYSDATE,'YYYY-
----------------------
2011-02-07 02:32:56 PM
Cheers
Ravi K
Ravi K