If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Problem with Date Format , ISO

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-09, 03:57
rammurugesan rammurugesan is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
Unhappy Problem with Date Format , ISO

Hi friends ,

I'm new to this forum adn to DB2 ... i'm on the verge of writing a script to automate some process .... i face problem in converting a date format to ISO from USA(default in my production box).
Given below is my script ...
----------------------------------------------------
day1=`$db2 -x "values current date"`
day2=`$db2 -x "values (current date) - 1 day"`
day3=`$db2 -x "values (current date) - 2 days"`
day4=`$db2 -x "values (current date) - 3 days"`
day5=`$db2 -x "values (current date) - 4 days"`
----------------------------------------------------

I need to get these output dates in ISO format (yyyy-mm-dd) ...

Somebody pls help me in getting the same....
Reply With Quote
  #2 (permalink)  
Old 06-10-09, 04:44
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
CHAR(date-expression, ISO)
Reply With Quote
  #3 (permalink)  
Old 06-10-09, 05:15
rammurugesan rammurugesan is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
ton ,

are u asking me to have my date function like

"day1=`$db2 -x "CHAR(current date,ISO)"`
"day2=`$db2 -x "CHAR(day1) - 1 day"`
Reply With Quote
  #4 (permalink)  
Old 06-10-09, 05:35
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
From
day2=`$db2 -x "values (current date) - 1 day"`

to
day2=`$db2 -x "values CHAR(current date - 1 day, ISO)"`
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On