September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
81
Task/Date-manipulation/Batch-File/date-manipulation.bat
Normal file
81
Task/Date-manipulation/Batch-File/date-manipulation.bat
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
@echo off
|
||||
|
||||
call:Date_Manipulation "March 7 2009 7:30pm EST"
|
||||
call:Date_Manipulation "February 28 2009 2:28pm EST"
|
||||
call:Date_Manipulation "February 29 2000 9:52pm EST"
|
||||
pause>nul
|
||||
exit /b
|
||||
|
||||
:Date_Manipulation
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: These are the arrays we'll be using
|
||||
set daysinmonth=31 28 31 30 31 30 31 31 30 31 30 31
|
||||
set namesofmonths=January February March April May June July August September October November December
|
||||
|
||||
:: Separate the date given ("%1") into respective variables. Note: For now the "am/pm" is attached to %minutes%
|
||||
for /f "tokens=1,2,3,4,5,6 delims=: " %%i in ("%~1") do (
|
||||
set monthname=%%i
|
||||
set day=%%j
|
||||
set year=%%k
|
||||
set hour=%%l
|
||||
set minutes=%%m
|
||||
set timezone=%%n
|
||||
)
|
||||
|
||||
:: Separate the am/pm and the minutes value into different variables
|
||||
set ampm=%minutes:~2,2%
|
||||
set minutes=%minutes:~0,2%
|
||||
|
||||
:: Check if the day needs to be changed based on the status of "am/pm"
|
||||
if %ampm%==pm (
|
||||
set /a day+=1
|
||||
set ampm=am
|
||||
) else (
|
||||
set ampm=pm
|
||||
)
|
||||
|
||||
:: Get the number corresponding to the month given
|
||||
set tempcount=0
|
||||
for %%i in (%namesofmonths%) do (
|
||||
set /a tempcount+=1
|
||||
if %monthname%==%%i set monthcount=!tempcount!
|
||||
)
|
||||
|
||||
:: As this step may may be needed to repeat if the month needs to be changed, we add a label here
|
||||
:getdaysinthemonth
|
||||
:: Work out how many days are in the current month
|
||||
set tempcount=0
|
||||
for %%i in (%daysinmonth%) do (
|
||||
set /a tempcount+=1
|
||||
if %monthcount%==!tempcount! set daysinthemonth=%%i
|
||||
)
|
||||
|
||||
:: If the month is February, check if it is a leap year. If so, add 1 to the amount of days in the month
|
||||
if %daysinthemonth%==28 (
|
||||
set /a leapyearcheck=%year% %% 4
|
||||
if !leapyearcheck!==0 set /a daysinthemonth+=1
|
||||
)
|
||||
|
||||
:: Check if the month needs to be changed based on the current day and how many days there are in the current month
|
||||
if %day% gtr %daysinthemonth% (
|
||||
set /a monthcount+=1
|
||||
set day=1
|
||||
if !monthcount! gtr 12 (
|
||||
set monthcount=1
|
||||
set /a year+=1
|
||||
)
|
||||
goto getdaysinthemonth
|
||||
)
|
||||
:: Everything from :getdaysinthemonth will be repeated once if the month needs to be changed
|
||||
|
||||
:: This block is only required to change the name of the month for the output, however as you have %monthcount%, this is optional
|
||||
set tempcount=0
|
||||
for %%i in (%namesofmonths%) do (
|
||||
set /a tempcount+=1
|
||||
if %monthcount%==!tempcount! set monthname=%%i
|
||||
)
|
||||
|
||||
echo Original - %~1
|
||||
echo Manipulated - %monthname% %day% %year% %hour%:%minutes%%ampm% %timezone%
|
||||
exit /b
|
||||
19
Task/Date-manipulation/Kotlin/date-manipulation.kotlin
Normal file
19
Task/Date-manipulation/Kotlin/date-manipulation.kotlin
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// version 1.0.6
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val dts = "March 7 2009 7:30pm EST"
|
||||
val sdf = SimpleDateFormat("MMMM d yyyy h:mma z")
|
||||
val dt = sdf.parse(dts)
|
||||
val cal = GregorianCalendar(TimeZone.getTimeZone("EST")) // stay with EST
|
||||
cal.time = dt
|
||||
cal.add(Calendar.HOUR_OF_DAY, 12) // add 12 hours
|
||||
val fmt = "%tB %1\$td %1\$tY %1\$tl:%1\$tM%1\$tp %1\$tZ"
|
||||
println(fmt.format(cal)) // display new time
|
||||
|
||||
// display time now in Mountain Standard Time which is 2 hours earlier than EST
|
||||
cal.timeZone = TimeZone.getTimeZone("MST")
|
||||
println(fmt.format(cal))
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
echo -ag $asctime($calc($ctime(March 7 2009 7:30pm EST)+43200))
|
||||
126
Task/Date-manipulation/OoRexx/date-manipulation-1.rexx
Normal file
126
Task/Date-manipulation/OoRexx/date-manipulation-1.rexx
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
sampleDate = 'March 7 2009 7:30pm EST'
|
||||
|
||||
Parse var sampleDate month day year time zone
|
||||
basedate = .DateTime~fromNormalDate(day month~left(3) year)
|
||||
basetime = .DateTime~fromCivilTime(time)
|
||||
-- this will give us this in a merged format...now we can add in the
|
||||
-- timezone informat
|
||||
mergedTime = (basedate + basetime~timeofday)~isoDate
|
||||
zone = .TimeZoneDataBase~getTimeZone(zone)
|
||||
|
||||
finalTime = .DateTime~fromIsoDate(mergedTime, zone~datetimeOffset)
|
||||
|
||||
say 'Original date:' finalTime~utcIsoDate
|
||||
say 'Result after adding 12 hours:' finalTime~addHours(12)~utcIsoDate
|
||||
say 'Result shifted to UTC:' finalTime~toTimeZone(0)~utcIsoDate
|
||||
say 'Result shifted to Pacific Standard Time:' finalTime~toTimeZone(.TimeZoneDataBase~getTimeZone('PST')~datetimeOffset)~utcIsoDate
|
||||
say 'Result shifted to NepalTime Time:' finalTime~toTimeZone(.TimeZoneDataBase~getTimeZone('NPT')~datetimeOffset)~utcIsoDate
|
||||
|
||||
-- a descriptor for timezone information
|
||||
::class timezone
|
||||
::method init
|
||||
expose code name offset altname region
|
||||
use strict arg code, name, offset, altname, region
|
||||
code~upper
|
||||
|
||||
::attribute code GET
|
||||
::attribute name GET
|
||||
::attribute offset GET
|
||||
::attribute altname GET
|
||||
::attribute region GET
|
||||
::attribute datetimeOffset GET
|
||||
expose offset
|
||||
return offset * 60
|
||||
|
||||
-- our database of timezones
|
||||
::class timezonedatabase
|
||||
-- initialize the class object. This occurs when the program is first loaded
|
||||
::method init class
|
||||
expose timezones
|
||||
|
||||
timezones = .directory~new
|
||||
-- extract the timezone data which is conveniently stored in a method
|
||||
data = self~instanceMethod('TIMEZONEDATA')~source
|
||||
|
||||
loop line over data
|
||||
-- skip over the comment delimiters, blank lines, and the 'return'
|
||||
-- lines that force the comments to be included in the source
|
||||
if line = '/*' | line = '*/' | line = '' | line = 'return' then iterate
|
||||
parse var line '{' region '}'
|
||||
if region \= '' then do
|
||||
zregion = region
|
||||
iterate
|
||||
end
|
||||
else do
|
||||
parse var line abbrev . '!' fullname '!' altname . '!' offset .
|
||||
timezone = .timezone~new(abbrev, fullname, offset, altname, zregion)
|
||||
timezones[timezone~code] = timezone
|
||||
end
|
||||
end
|
||||
|
||||
::method getTimezone class
|
||||
expose timezones
|
||||
use strict arg code
|
||||
return timezones[code~upper]
|
||||
|
||||
-- this is a dummy method containing the timezone database data.
|
||||
-- we'll access the source directly and extract the data held in comments
|
||||
-- the two return statements force the comment lines to be included in the
|
||||
-- source rather than processed as part of comments between directives
|
||||
::method timeZoneData class private
|
||||
return
|
||||
/*
|
||||
{Universal}
|
||||
UTC ! Coordinated Universal Time ! ! 0
|
||||
|
||||
{Europe}
|
||||
BST ! British Summer Time ! ! +1
|
||||
CEST ! Central European Summer Time ! ! +2
|
||||
CET ! Central European Time ! ! +1
|
||||
EEST ! Eastern European Summer Time ! ! +3
|
||||
EET ! Eastern European Time ! ! +2
|
||||
GMT ! Greenwich Mean Time ! ! 0
|
||||
IST ! Irish Standard Time ! ! +1
|
||||
KUYT ! Kuybyshev Time ! ! +4
|
||||
MSD ! Moscow Daylight Time ! ! +4
|
||||
MSK ! Moscow Standard Time ! ! +3
|
||||
SAMT ! Samara Time ! ! +4
|
||||
WEST ! Western European Summer Time ! ! +1
|
||||
WET ! Western European Time ! ! 0
|
||||
|
||||
{North America}
|
||||
ADT ! Atlantic Daylight Time ! HAA ! -3
|
||||
AKDT ! Alaska Daylight Time ! HAY ! -8
|
||||
AKST ! Alaska Standard Time ! HNY ! -9
|
||||
AST ! Atlantic Standard Time ! HNA ! -4
|
||||
CDT ! Central Daylight Time ! HAC ! -5
|
||||
CST ! Central Standard Time ! HNC ! -6
|
||||
EDT ! Eastern Daylight Time ! HAE ! -4
|
||||
EGST ! Eastern Greenland Summer Time ! ! 0
|
||||
EGT ! East Greenland Time ! ! -1
|
||||
EST ! Eastern Standard Time ! HNE,ET ! -5
|
||||
HADT ! Hawaii-Aleutian Daylight Time ! ! -9
|
||||
HAST ! Hawaii-Aleutian Standard Time ! ! -10
|
||||
MDT ! Mountain Daylight Time ! HAR ! -6
|
||||
MST ! Mountain Standard Time ! HNR ! -7
|
||||
NDT ! Newfoundland Daylight Time ! HAT ! -2.5
|
||||
NST ! Newfoundland Standard Time ! HNT ! -3.5
|
||||
PDT ! Pacific Daylight Time ! HAP ! -7
|
||||
PMDT ! Pierre & Miquelon Daylight Time ! ! -2
|
||||
PMST ! Pierre & Miquelon Standard Time ! ! -3
|
||||
PST ! Pacific Standard Time ! HNP,PT ! -8
|
||||
WGST ! Western Greenland Summer Time ! ! -2
|
||||
WGT ! West Greenland Time ! ! -3
|
||||
|
||||
{India and Indian Ocean}
|
||||
IST ! India Standard Time ! ! +5.5
|
||||
PKT ! Pakistan Standard Time ! ! +5
|
||||
BST ! Bangladesh Standard Time ! ! +6 -- Note: collision with British Summer Time
|
||||
NPT ! Nepal Time ! ! +5.75
|
||||
BTT ! Bhutan Time ! ! +6
|
||||
BIOT ! British Indian Ocean Territory Time ! IOT ! +6
|
||||
MVT ! Maldives Time ! ! +5
|
||||
CCT ! Cocos Islands Time ! ! +6.5
|
||||
TFT ! French Southern and Antarctic Time ! ! +5
|
||||
*/
|
||||
return
|
||||
217
Task/Date-manipulation/OoRexx/date-manipulation-2.rexx
Normal file
217
Task/Date-manipulation/OoRexx/date-manipulation-2.rexx
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/* Rexx */
|
||||
sampleDate = 'March 7 2009 7:30pm EST'
|
||||
|
||||
Parse value sampleDate with tm td ty tt tz .
|
||||
Parse value time('l', tt, 'c') with hh ':' mm ':' ss '.' us .
|
||||
|
||||
timezones. = ''
|
||||
Call initTimezones
|
||||
mn = monthNameToNumber(tm)
|
||||
zuluOffset = getTZOffset(tz)
|
||||
|
||||
Drop !TZ !MSG
|
||||
day.1.!TZ = zuluOffset
|
||||
day.1.!MSG = 'Original date:'
|
||||
day.1 = .DateTime~new(ty, mn, td, hh, mm, ss, us, day.1.!TZ * 60)
|
||||
day.2.!TZ = zuluOffset
|
||||
day.2.!MSG = 'Result after adding 12 hours to date:'
|
||||
day.2 = day.1~addHours(12)
|
||||
day.3.!TZ = getTZOffset('UTC') -- AKA GMT == Greenwich Mean Time
|
||||
day.3.!MSG = 'Result shifted to "UTC (Zulu)" time zone:'
|
||||
day.3 = day.1~toTimeZone(day.3.!TZ)
|
||||
day.4.!TZ = getTZOffset('PST') -- Pacific Standard Time
|
||||
day.4.!MSG = 'Result shifted to "Pacific Standard Time" time zone:'
|
||||
day.4 = day.2~toTimeZone(day.4.!TZ * 60)
|
||||
day.5.!TZ = getTZOffset('NPT') -- Nepal Time
|
||||
day.5.!MSG = 'Result shifted to "Nepal Time" time zone:'
|
||||
day.5 = day.2~toTimeZone(day.5.!TZ * 60)
|
||||
day.0 = 5
|
||||
|
||||
Say 'Manipulate the date string "'sampleDate'" and present results in ISO 8601 timestamp format:'
|
||||
Say
|
||||
Loop d_ = 1 to day.0
|
||||
Say day.d_.!MSG
|
||||
Say day.d_~isoDate || getUTCOffset(day.d_.!TZ, 'z')
|
||||
Say
|
||||
End d_
|
||||
|
||||
Return 0
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
isTrue: Procedure; Return (1 == 1)
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
isFalse: Procedure; Return \isTrue()
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
monthNameToNumber:
|
||||
Procedure
|
||||
Do
|
||||
Parse arg tm .
|
||||
|
||||
mnamesList = 'January February March April May June July August September October November December'
|
||||
|
||||
Loop mn = 1 to mnamesList~words
|
||||
mnx = mnamesList~word(mn)
|
||||
If mnx~upper~abbrev(tm~upper, 3) then Do
|
||||
Leave mn
|
||||
End
|
||||
End mn
|
||||
|
||||
Return mn
|
||||
End
|
||||
Exit
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
getTZOffset:
|
||||
Procedure expose timezones.
|
||||
Do
|
||||
Parse upper arg tz .
|
||||
Drop !REGION !FULLNAME !OFFSET !ZNAMEALT
|
||||
|
||||
offset = 0
|
||||
Loop z_ = 1 to timezones.0
|
||||
If tz = timezones.z_ then Do
|
||||
offset = timezones.z_.!OFFSET
|
||||
Leave z_
|
||||
End
|
||||
End z_
|
||||
|
||||
Return offset;
|
||||
End
|
||||
Exit
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
getUTCOffset:
|
||||
Procedure expose timezones.
|
||||
Do
|
||||
Parse arg oh ., zulu .
|
||||
|
||||
oha = abs(oh)
|
||||
If oha = 0 & 'ZULU'~abbrev(zulu~upper, 1) then Do
|
||||
offset = 'Z'
|
||||
End
|
||||
else Do
|
||||
If oh < 0 then ew = '-'
|
||||
else ew = '+'
|
||||
om = oha * 60
|
||||
oom = om // 60 % 1
|
||||
ooh = om % 60
|
||||
offset = ew || ooh~right(2, 0) || oom~right(2, 0)
|
||||
End
|
||||
|
||||
Return offset
|
||||
End
|
||||
Exit
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
initTimezones:
|
||||
Procedure expose timezones.
|
||||
Do
|
||||
-- Read time zone info from formatted comment block below
|
||||
Drop !REGION !FULLNAME !OFFSET !ZNAMEALT
|
||||
timezones.0 = 0
|
||||
region = ''
|
||||
!datBegin = '__DATA__'
|
||||
!datEnd = '__ENDD__'
|
||||
!reading = isFalse()
|
||||
|
||||
Loop l_ = 1 to sourceline()
|
||||
Parse value sourceline(l_) with sl 0 hd +8 .
|
||||
If !reading then Do
|
||||
If hd = !datEnd then Do
|
||||
!reading = isFalse()
|
||||
Leave l_
|
||||
End
|
||||
else Do
|
||||
Parse value sl with sl '--' .
|
||||
If sl~strip~length = 0 then Iterate l_
|
||||
Parse value sl with,
|
||||
0 '{' zRegion '}',
|
||||
0 zAbbrev . '!' zFullName '!' zAbbrevOther . '!' zUOffset .
|
||||
If zRegion~length \= 0 then Do
|
||||
region = zRegion
|
||||
Iterate l_
|
||||
End
|
||||
else Do
|
||||
z_ = timezones.0 + 1
|
||||
timezones.0 = z_
|
||||
timezones.z_ = zAbbrev~strip~upper
|
||||
timezones.z_.!FULLNAME = zFullName~strip
|
||||
timezones.z_.!OFFSET = zUOffset~format
|
||||
timezones.z_.!ZNAMEALT = zAbbrevOther~strip~upper
|
||||
timezones.z_.!REGION = region
|
||||
End
|
||||
End
|
||||
End
|
||||
else Do
|
||||
If hd = !datBegin then Do
|
||||
!reading = isTrue()
|
||||
End
|
||||
Iterate l_
|
||||
End
|
||||
End l_
|
||||
|
||||
Return timezones.0
|
||||
End
|
||||
Exit
|
||||
/*
|
||||
A "HERE" document, sort of...
|
||||
Everything between the __DATA__ and __ENDD__ delimiters will be read into the timezones. stem:
|
||||
|
||||
__DATA__
|
||||
{Universal}
|
||||
UTC ! Coordinated Universal Time ! ! 0
|
||||
|
||||
{Europe}
|
||||
BST ! British Summer Time ! ! +1
|
||||
CEST ! Central European Summer Time ! ! +2
|
||||
CET ! Central European Time ! ! +1
|
||||
EEST ! Eastern European Summer Time ! ! +3
|
||||
EET ! Eastern European Time ! ! +2
|
||||
GMT ! Greenwich Mean Time ! ! 0
|
||||
IST ! Irish Standard Time ! ! +1
|
||||
KUYT ! Kuybyshev Time ! ! +4
|
||||
MSD ! Moscow Daylight Time ! ! +4
|
||||
MSK ! Moscow Standard Time ! ! +3
|
||||
SAMT ! Samara Time ! ! +4
|
||||
WEST ! Western European Summer Time ! ! +1
|
||||
WET ! Western European Time ! ! 0
|
||||
|
||||
{North America}
|
||||
ADT ! Atlantic Daylight Time ! HAA ! -3
|
||||
AKDT ! Alaska Daylight Time ! HAY ! -8
|
||||
AKST ! Alaska Standard Time ! HNY ! -9
|
||||
AST ! Atlantic Standard Time ! HNA ! -4
|
||||
CDT ! Central Daylight Time ! HAC ! -5
|
||||
CST ! Central Standard Time ! HNC ! -6
|
||||
EDT ! Eastern Daylight Time ! HAE ! -4
|
||||
EGST ! Eastern Greenland Summer Time ! ! 0
|
||||
EGT ! East Greenland Time ! ! -1
|
||||
EST ! Eastern Standard Time ! HNE,ET ! -5
|
||||
HADT ! Hawaii-Aleutian Daylight Time ! ! -9
|
||||
HAST ! Hawaii-Aleutian Standard Time ! ! -10
|
||||
MDT ! Mountain Daylight Time ! HAR ! -6
|
||||
MST ! Mountain Standard Time ! HNR ! -7
|
||||
NDT ! Newfoundland Daylight Time ! HAT ! -2.5
|
||||
NST ! Newfoundland Standard Time ! HNT ! -3.5
|
||||
PDT ! Pacific Daylight Time ! HAP ! -7
|
||||
PMDT ! Pierre & Miquelon Daylight Time ! ! -2
|
||||
PMST ! Pierre & Miquelon Standard Time ! ! -3
|
||||
PST ! Pacific Standard Time ! HNP,PT ! -8
|
||||
WGST ! Western Greenland Summer Time ! ! -2
|
||||
WGT ! West Greenland Time ! ! -3
|
||||
|
||||
{India and Indian Ocean}
|
||||
IST ! India Standard Time ! ! +5.5
|
||||
PKT ! Pakistan Standard Time ! ! +5
|
||||
BST ! Bangladesh Standard Time ! ! +6 -- Note: collision with British Summer Time
|
||||
NPT ! Nepal Time ! ! +5.75
|
||||
BTT ! Bhutan Time ! ! +6
|
||||
BIOT ! British Indian Ocean Territory Time ! IOT ! +6
|
||||
MVT ! Maldives Time ! ! +5
|
||||
CCT ! Cocos Islands Time ! ! +6.5
|
||||
TFT ! French Southern and Antarctic Time ! ! +5
|
||||
|
||||
__ENDD__
|
||||
*/
|
||||
32
Task/Date-manipulation/SQL/date-manipulation.sql
Normal file
32
Task/Date-manipulation/SQL/date-manipulation.sql
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
-- March 7 2009 7:30pm EST
|
||||
|
||||
select
|
||||
TO_TIMESTAMP_TZ(
|
||||
'March 7 2009 7:30pm EST',
|
||||
'MONTH DD YYYY HH:MIAM TZR'
|
||||
)
|
||||
at time zone 'US/Eastern' orig_dt_time
|
||||
from dual;
|
||||
|
||||
-- 12 hours later DST change
|
||||
|
||||
select
|
||||
(TO_TIMESTAMP_TZ(
|
||||
'March 7 2009 7:30pm EST',
|
||||
'MONTH DD YYYY HH:MIAM TZR'
|
||||
)+
|
||||
INTERVAL '12' HOUR)
|
||||
at time zone 'US/Eastern' plus_12_dst
|
||||
from dual;
|
||||
|
||||
-- 12 hours later no DST change
|
||||
-- Arizona time, always MST
|
||||
|
||||
select
|
||||
(TO_TIMESTAMP_TZ(
|
||||
'March 7 2009 7:30pm EST',
|
||||
'MONTH DD YYYY HH:MIAM TZR'
|
||||
)+
|
||||
INTERVAL '12' HOUR)
|
||||
at time zone 'US/Arizona' plus_12_nodst
|
||||
from dual;
|
||||
11
Task/Date-manipulation/Zkl/date-manipulation-1.zkl
Normal file
11
Task/Date-manipulation/Zkl/date-manipulation-1.zkl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
var Date=Time.Date;
|
||||
fcn add12h(dt){
|
||||
re:=RegExp(0'|(\w+)\s+(\d+)\s+(\d+)\ +(.+)\s|);
|
||||
re.search(dt);
|
||||
_,M,D,Y,hms:=re.matched; //"March","7","2009","7:30pm"
|
||||
M=Date.monthNames.index(M); //3
|
||||
h,m,s:=Date.parseTime(hms); //19,30,0
|
||||
dti:=T(Y,M,D, h,m,s).apply("toInt");
|
||||
Y,M,D, h,m,s=Date.addHMS(dti,12);
|
||||
"%s %d %d %s".fmt(Date.monthNames[M],D,Y,Date.toAMPMString(h,m));
|
||||
}
|
||||
1
Task/Date-manipulation/Zkl/date-manipulation-2.zkl
Normal file
1
Task/Date-manipulation/Zkl/date-manipulation-2.zkl
Normal file
|
|
@ -0,0 +1 @@
|
|||
add12h("March 7 2009 7:30pm EST").println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue