Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Date-manipulation/NetRexx/date-manipulation.netrexx
Normal file
29
Task/Date-manipulation/NetRexx/date-manipulation.netrexx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols binary
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import java.text.ParseException
|
||||
|
||||
runSample(arg)
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method manipulateDate(sampleDate, dateFmt, dHours = 0) private static
|
||||
formatter = SimpleDateFormat(dateFmt)
|
||||
msHours = dHours * 60 * 60 * 1000 -- hours in milliseconds
|
||||
day = formatter.parse(sampleDate)
|
||||
day.setTime(day.getTime() + msHours)
|
||||
formatted = formatter.format(day)
|
||||
return formatted
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method runSample(arg) private static
|
||||
do
|
||||
sampleDate = 'March 7 2009 7:30pm EST'
|
||||
dateFmt = "MMMM d yyyy h:mma z"
|
||||
say sampleDate
|
||||
say manipulateDate(sampleDate, dateFmt, 12)
|
||||
catch ex = Exception
|
||||
ex.printStackTrace()
|
||||
end
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue