Date manipulation: Difference between revisions
Content added Content deleted
Line 2,290: | Line 2,290: | ||
load "stdlib.ring" |
load "stdlib.ring" |
||
dateorigin = "March 7 2009 7:30pm EST" |
|||
monthname = "January February March April May June July August September October November December" |
monthname = "January February March April May June July August September October November December" |
||
for i = 1 to 12 |
for i = 1 to 12 |
||
if |
if dateorigin[1] = monthname[i] |
||
monthnum = i |
monthnum = i |
||
ok |
ok |
||
next |
next |
||
thedate = str2list(substr( |
thedate = str2list(substr(dateorigin, " ", nl)) |
||
t = thedate[4] |
t = thedate[4] |
||
t1 = substr(t,"pm", "") |
t1 = substr(t,"pm", "") |
||
Line 2,311: | Line 2,311: | ||
ap = "am" |
ap = "am" |
||
ok |
ok |
||
see |
see "Original - " + dateorigin + nl |
||
see "Manipulated - " + d + " " + t1 + ap + nl |
|||
</lang> |
</lang> |
||
Output: |
Output: |
||
<pre> |
<pre> |
||
Original - March 7 2009 7:30pm EST |
|||
Manipulated - 08/03/2009 7:30am |
|||
</pre> |
</pre> |
||