langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
3
Task/Date-format/NetRexx/date-format.netrexx
Normal file
3
Task/Date-format/NetRexx/date-format.netrexx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import java.text.SimpleDateFormat
|
||||
say SimpleDateFormat("yyyy-MM-dd").format(Date())
|
||||
say SimpleDateFormat("EEEE, MMMM dd, yyyy").format(Date())
|
||||
34
Task/Date-format/NewLISP/date-format.newlisp
Normal file
34
Task/Date-format/NewLISP/date-format.newlisp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
; file: date-format.lsp
|
||||
; url: http://rosettacode.org/wiki/Date_format
|
||||
; author: oofoe 2012-02-01
|
||||
|
||||
; The "now" function returns the current time as a list. A time zone
|
||||
; offset in minutes can be supplied. The example below is for Eastern
|
||||
; Standard Time. NewLISP's implicit list indexing is used to extract
|
||||
; the first three elements of the returned list (year, month and day).
|
||||
|
||||
(setq n (now (* -5 60)))
|
||||
(println "short: " (format "%04d-%02d-%02d" (n 0) (n 1) (n 2)))
|
||||
|
||||
; The "date-value" function returns the time in seconds from the epoch
|
||||
; when used without arguments. The "date" function converts the
|
||||
; seconds into a time representation specified by the format string at
|
||||
; the end. The offset argument ("0" in this example) specifies a
|
||||
; time-zone offset in minutes.
|
||||
|
||||
(println "short: " (date (date-value) 0 "%Y-%m-%d"))
|
||||
|
||||
; The time formatting is supplied by the underlying C library, so
|
||||
; there may be differences on certain platforms. Particularly, leading
|
||||
; zeroes in day numbers can be suppressed with "%-d" on Linux and
|
||||
; FreeBSD, "%e" on OpenBSD, SunOS/Solaris and Mac OS X. Use "%#d" for
|
||||
; Windows.
|
||||
|
||||
(println "long: " (date (date-value) 0 "%A, %B %#d, %Y"))
|
||||
|
||||
; By setting the locale, the date will be displayed appropriately:
|
||||
|
||||
(set-locale "japanese")
|
||||
(println "long: " (date (date-value) 0 "%A, %B %#d, %Y"))
|
||||
|
||||
(exit)
|
||||
5
Task/Date-format/Nimrod/date-format.nimrod
Normal file
5
Task/Date-format/Nimrod/date-format.nimrod
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import times
|
||||
|
||||
var t = getTime().getLocalTime()
|
||||
echo(t.format("yyyy-MM-dd"))
|
||||
echo(t.format("dddd',' MMMM d',' yyyy"))
|
||||
13
Task/Date-format/OCaml/date-format-1.ocaml
Normal file
13
Task/Date-format/OCaml/date-format-1.ocaml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# #load "unix.cma";;
|
||||
# open Unix;;
|
||||
|
||||
# let t = time() ;;
|
||||
val t : float = 1219997516.
|
||||
|
||||
# let gmt = gmtime t ;;
|
||||
val gmt : Unix.tm =
|
||||
{tm_sec = 56; tm_min = 11; tm_hour = 8; tm_mday = 29; tm_mon = 7;
|
||||
tm_year = 108; tm_wday = 5; tm_yday = 241; tm_isdst = false}
|
||||
|
||||
# Printf.sprintf "%d-%02d-%02d" (1900 + gmt.tm_year) (1 + gmt.tm_mon) gmt.tm_mday ;;
|
||||
- : string = "2008-08-29"
|
||||
12
Task/Date-format/OCaml/date-format-2.ocaml
Normal file
12
Task/Date-format/OCaml/date-format-2.ocaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
let months = [| "January"; "February"; "March"; "April"; "May"; "June";
|
||||
"July"; "August"; "September"; "October"; "November"; "December" |]
|
||||
|
||||
let days = [| "Sunday"; "Monday"; "Tuesday"; (* Sunday is 0 *)
|
||||
"Wednesday"; "Thursday"; "Friday"; "Saturday" |]
|
||||
|
||||
# Printf.sprintf "%s, %s %d, %d"
|
||||
days.(gmt.tm_wday)
|
||||
months.(gmt.tm_mon)
|
||||
gmt.tm_mday
|
||||
(1900 + gmt.tm_year) ;;
|
||||
- : string = "Friday, August 29, 2008"
|
||||
15
Task/Date-format/Objeck/date-format.objeck
Normal file
15
Task/Date-format/Objeck/date-format.objeck
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use IO;
|
||||
use Time;
|
||||
|
||||
bundle Default {
|
||||
class CurrentDate {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
t := Date->New();
|
||||
Console->Print(t->GetYear())->Print("-")->Print(t->GetMonth())->Print("-")
|
||||
->PrintLine(t->GetDay());
|
||||
Console->Print(t->GetDayName())->Print(", ")->Print(t->GetMonthName())
|
||||
->Print(" ")->Print(t->GetDay())->Print(", ")
|
||||
->PrintLine(t->GetYear());
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Task/Date-format/Objective-C/date-format-1.m
Normal file
3
Task/Date-format/Objective-C/date-format-1.m
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
NSLog(@"%@", [NSDate date]);
|
||||
NSLog(@"%@", [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil]);
|
||||
NSLog(@"%@", [[NSDate date] descriptionWithCalendarFormat:@"%A, %B %d, %Y" timeZone:nil locale:nil]);
|
||||
7
Task/Date-format/Objective-C/date-format-2.m
Normal file
7
Task/Date-format/Objective-C/date-format-2.m
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
NSLog(@"%@", [NSDate date]);
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormat alloc] init];
|
||||
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
|
||||
NSLog(@"%@", [dateFormatter stringFromDate:[NSDate date]]);
|
||||
[dateFormatter setDateFormat:@"EEEE, MMMM d, yyyy"];
|
||||
NSLog(@"%@", [dateFormatter stringFromDate:[NSDate date]]);
|
||||
[dateFormatter release];
|
||||
31
Task/Date-format/OxygenBasic/date-format.oxy
Normal file
31
Task/Date-format/OxygenBasic/date-format.oxy
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
extern lib "kernel32.dll"
|
||||
|
||||
'http://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
|
||||
|
||||
typedef struct _SYSTEMTIME {
|
||||
WORD wYear;
|
||||
WORD wMonth;
|
||||
WORD wDayOfWeek;
|
||||
WORD wDay;
|
||||
WORD wHour;
|
||||
WORD wMinute;
|
||||
WORD wSecond;
|
||||
WORD wMilliseconds;
|
||||
} SYSTEMTIME, *PSYSTEMTIME;
|
||||
|
||||
void GetSystemTime(SYSTEMTIME*t);
|
||||
void GetLocalTime(SYSTEMTIME*t);
|
||||
|
||||
end extern
|
||||
|
||||
SYSTEMTIME t
|
||||
'GetSystemTime t 'GMT (Greenwich Mean Time)
|
||||
GetLocalTime t
|
||||
|
||||
String WeekDay[7]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}
|
||||
String MonthName[12]={"January","February","March","April","May","June","July","August","September","October","November","December"}
|
||||
String month=str t.wMonth : if len(month)<2 then month="0"+month
|
||||
String day=str t.wDay : if len(day)<2 then day="0"+day
|
||||
'
|
||||
print "" t.wYear "-" month "-" day
|
||||
print WeekDay[t.wDayOfWeek+1 and 7 ] " " MonthName[t.wMonth and 31] " " t.wDay " " t.wYear
|
||||
26
Task/Date-format/Oz/date-format.oz
Normal file
26
Task/Date-format/Oz/date-format.oz
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
declare
|
||||
WeekDays = unit(0:"Sunday" "Monday" "Tuesday" "Wednesday"
|
||||
"Thursday" "Friday" "Saturday")
|
||||
Months = unit(0:"January" "February" "March" "April"
|
||||
"May" "June" "July" "August" "September"
|
||||
"October" "November" "December")
|
||||
|
||||
fun {DateISO Time}
|
||||
Year = 1900 + Time.year
|
||||
Month = Time.mon + 1
|
||||
in
|
||||
Year#"-"#{Align Month}#"-"#{Align Time.mDay}
|
||||
end
|
||||
|
||||
fun {DateLong Time}
|
||||
Year = 1900 + Time.year
|
||||
in
|
||||
WeekDays.(Time.wDay)#", "#Months.(Time.mon)#" "#Time.mDay#", "#Year
|
||||
end
|
||||
|
||||
fun {Align Num}
|
||||
if Num < 10 then "0"#Num else Num end
|
||||
end
|
||||
in
|
||||
{System.showInfo {DateISO {OS.localTime}}}
|
||||
{System.showInfo {DateLong {OS.localTime}}}
|
||||
12
Task/Date-format/PL-I/date-format.pli
Normal file
12
Task/Date-format/PL-I/date-format.pli
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
declare day_of_week(7) character (9) varying initial
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday',
|
||||
'Thursday', 'Friday', 'Saturday');
|
||||
declare today character (8);
|
||||
|
||||
today = datetime('YYYYMMDD');
|
||||
put edit (substr(today, 1, 4), '-', substr(today, 5, 2), '-', substr(today, 7) ) (A);
|
||||
|
||||
today = datetime('MmmDDYYYY');
|
||||
|
||||
put skip edit (day_of_week(weekday(days())), ', ') (A);
|
||||
put edit (substr(today, 1, 3), ' ', substr(today, 4, 2), ',', substr(today, 6, 4) ) (A);
|
||||
55
Task/Date-format/Pascal/date-format.pascal
Normal file
55
Task/Date-format/Pascal/date-format.pascal
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
program dateform;
|
||||
uses DOS;
|
||||
|
||||
{ Format digit with leading zero }
|
||||
function lz(w: word): string;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
str(w,s);
|
||||
if length(s) = 1 then
|
||||
s := '0' + s;
|
||||
lz := s
|
||||
end;
|
||||
|
||||
function m2s(mon: integer): string;
|
||||
begin
|
||||
case mon of
|
||||
1: m2s := 'January';
|
||||
2: m2s := 'February';
|
||||
3: m2s := 'March';
|
||||
4: m2s := 'April';
|
||||
5: m2s := 'May';
|
||||
6: m2s := 'June';
|
||||
7: m2s := 'July';
|
||||
8: m2s := 'August';
|
||||
9: m2s := 'September';
|
||||
10: m2s := 'October';
|
||||
11: m2s := 'November';
|
||||
12: m2s := 'December'
|
||||
end
|
||||
end;
|
||||
|
||||
function d2s(dow: integer): string;
|
||||
begin
|
||||
case dow of
|
||||
0: d2s := 'Sunday';
|
||||
1: d2s := 'Monday';
|
||||
2: d2s := 'Tueday';
|
||||
3: d2s := 'Wednesday';
|
||||
4: d2s := 'Thursday';
|
||||
5: d2s := 'Friday';
|
||||
6: d2s := 'Saturday'
|
||||
end
|
||||
end;
|
||||
|
||||
var
|
||||
yr,mo,dy,dow: word;
|
||||
mname,dname: string;
|
||||
|
||||
begin
|
||||
GetDate(yr,mo,dy,dow);
|
||||
writeln(yr,'-',lz(mo),'-',lz(dy));
|
||||
mname := m2s(mo); dname := d2s(dow);
|
||||
writeln(dname,', ',mname,' ',dy,', ',yr)
|
||||
end.
|
||||
6
Task/Date-format/Perl-6/date-format.pl6
Normal file
6
Task/Date-format/Perl-6/date-format.pl6
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
use DateTime::Utils;
|
||||
|
||||
my $dt = DateTime.now;
|
||||
|
||||
say strftime('%Y-%m-%d', $dt);
|
||||
say strftime('%A, %B %d, %Y', $dt);
|
||||
11
Task/Date-format/Pike/date-format.pike
Normal file
11
Task/Date-format/Pike/date-format.pike
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
> write("%d-%02d-%02d\n", day->year_no(), day->month_no(), day->month_day());
|
||||
2011-11-05
|
||||
|
||||
> write("%s, %s %s, %s\n", day->week_day_name(), day->month_name(), day->month_day_name(), day->year_name());
|
||||
Saturday, November 5, 2011
|
||||
|
||||
> write(day->format_ymd()+"\n");
|
||||
2011-11-05
|
||||
|
||||
> write(day->format_ext_ymd()+"\n");
|
||||
Saturday, 5 November 2011
|
||||
2
Task/Date-format/PowerShell/date-format.psh
Normal file
2
Task/Date-format/PowerShell/date-format.psh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"{0:yyyy-MM-dd}" -f (Get-Date)
|
||||
"{0:dddd, MMMM d, yyyy}" -f (Get-Date)
|
||||
41
Task/Date-format/PureBasic/date-format.purebasic
Normal file
41
Task/Date-format/PureBasic/date-format.purebasic
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
;Declare Procedures
|
||||
Declare.s MonthInText()
|
||||
Declare.s DayInText()
|
||||
|
||||
;Output the requested strings
|
||||
Debug FormatDate("%yyyy-%mm-%dd", Date())
|
||||
Debug DayInText() + ", " + MonthInText() + FormatDate(" %dd, %yyyy", Date())
|
||||
|
||||
;Used procedures
|
||||
Procedure.s DayInText()
|
||||
Protected d$
|
||||
Select DayOfWeek(Date())
|
||||
Case 1: d$="Monday"
|
||||
Case 2: d$="Tuesday"
|
||||
Case 3: d$="Wednesday"
|
||||
Case 4: d$="Thursday"
|
||||
Case 5: d$="Friday"
|
||||
Case 6: d$="Saturday"
|
||||
Default: d$="Sunday"
|
||||
EndSelect
|
||||
ProcedureReturn d$
|
||||
EndProcedure
|
||||
|
||||
Procedure.s MonthInText()
|
||||
Protected m$
|
||||
Select Month(Date())
|
||||
Case 1: m$="January"
|
||||
Case 2: m$="February"
|
||||
Case 3: m$="March"
|
||||
Case 4: m$="April"
|
||||
Case 5: m$="May"
|
||||
Case 6: m$="June"
|
||||
Case 7: m$="July"
|
||||
Case 8: m$="August"
|
||||
Case 9: m$="September"
|
||||
Case 10:m$="October"
|
||||
Case 11:m$="November"
|
||||
Default:m$="December"
|
||||
EndSelect
|
||||
ProcedureReturn m$
|
||||
EndProcedure
|
||||
25
Task/Date-format/REBOL/date-format.rebol
Normal file
25
Task/Date-format/REBOL/date-format.rebol
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
REBOL [
|
||||
Title: "Date Formatting"
|
||||
Author: oofoe
|
||||
Date: 2009-12-06
|
||||
URL: http://rosettacode.org/wiki/Date_format
|
||||
]
|
||||
|
||||
; REBOL has no built-in pictured output.
|
||||
|
||||
zeropad: func [pad n][
|
||||
n: to-string n
|
||||
insert/dup n "0" (pad - length? n)
|
||||
n
|
||||
]
|
||||
d02: func [n][zeropad 2 n]
|
||||
|
||||
print now ; Native formatting.
|
||||
|
||||
print rejoin [now/year "-" d02 now/month "-" d02 now/day]
|
||||
|
||||
print rejoin [
|
||||
pick system/locale/days now/weekday ", "
|
||||
pick system/locale/months now/month " "
|
||||
now/day ", " now/year
|
||||
]
|
||||
1
Task/Date-format/Raven/date-format-1.raven
Normal file
1
Task/Date-format/Raven/date-format-1.raven
Normal file
|
|
@ -0,0 +1 @@
|
|||
time int as today
|
||||
1
Task/Date-format/Raven/date-format-2.raven
Normal file
1
Task/Date-format/Raven/date-format-2.raven
Normal file
|
|
@ -0,0 +1 @@
|
|||
today '%Y-%m-%d' date
|
||||
1
Task/Date-format/Raven/date-format-3.raven
Normal file
1
Task/Date-format/Raven/date-format-3.raven
Normal file
|
|
@ -0,0 +1 @@
|
|||
today '%A, %B %d, %Y' date
|
||||
5
Task/Date-format/Run-BASIC/date-format.run
Normal file
5
Task/Date-format/Run-BASIC/date-format.run
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
'Display the current date in the formats of "2007-11-10" and "Sunday, November 10, 2007".
|
||||
print date$("yyyy-mm-dd")
|
||||
print date$("dddd");", "; 'return full day of the week (eg. Wednesday
|
||||
print date$("mmmm");" "; 'return full month name (eg. March)
|
||||
print date$("dd, yyyy") 'return day, year
|
||||
14
Task/Date-format/Seed7/date-format.seed7
Normal file
14
Task/Date-format/Seed7/date-format.seed7
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "time.s7i";
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
const array string: months is [] ("January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December");
|
||||
const array string: days is [] ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
|
||||
var time: now is time.value;
|
||||
begin
|
||||
now := time(NOW);
|
||||
writeln(strDate(now));
|
||||
writeln(days[dayOfWeek(now)] <& ", " <& months[now.month] <& " " <& now.day <& ", " <& now.year);
|
||||
end func;
|
||||
2
Task/Date-format/Shiny/date-format.shiny
Normal file
2
Task/Date-format/Shiny/date-format.shiny
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
say time.format 'Y-m-d' time.now
|
||||
say time.format 'l, F j, Y' time.now
|
||||
2
Task/Date-format/Standard-ML/date-format.ml
Normal file
2
Task/Date-format/Standard-ML/date-format.ml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
print (Date.fmt "%Y-%m-%d" (Date.fromTimeLocal (Time.now ())) ^ "\n");
|
||||
print (Date.fmt "%A, %B %d, %Y" (Date.fromTimeLocal (Time.now ())) ^ "\n");
|
||||
2
Task/Date-format/Suneido/date-format.suneido
Normal file
2
Task/Date-format/Suneido/date-format.suneido
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Date().Format('yyyy-MM-dd') --> "2010-03-16"
|
||||
Date().LongDate() --> "Tuesday, March 16, 2010"
|
||||
27
Task/Date-format/TUSCRIPT/date-format.tuscript
Normal file
27
Task/Date-format/TUSCRIPT/date-format.tuscript
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
$$ MODE TUSCRIPT
|
||||
SET dayofweek = DATE (today,day,month,year,number)
|
||||
|
||||
SET months=*
|
||||
DATA January
|
||||
DATA Februari
|
||||
DATA March
|
||||
DATA April
|
||||
DATA Mai
|
||||
DATA June
|
||||
DATA July
|
||||
DATA August
|
||||
DATA September
|
||||
DATA October
|
||||
DATA November
|
||||
DATA December
|
||||
|
||||
SET days="Monday'Tuesday'Wendsday'Thursday'Fryday'Saturday'Sonday"
|
||||
|
||||
SET nameofday =SELECT (days,#dayofweek)
|
||||
SET nameofmonth=SELECT (months,#month)
|
||||
|
||||
SET format1=JOIN (year,"-",month,day)
|
||||
SET format2=CONCAT (nameofday,", ",nameofmonth," ",day, ", ",year)
|
||||
|
||||
PRINT format1
|
||||
PRINT format2
|
||||
2
Task/Date-format/UNIX-Shell/date-format.sh
Normal file
2
Task/Date-format/UNIX-Shell/date-format.sh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
date +"%Y-%m-%d"
|
||||
date +"%A, %B %d, %Y"
|
||||
17
Task/Date-format/Ursala/date-format.ursala
Normal file
17
Task/Date-format/Ursala/date-format.ursala
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#import std
|
||||
#import cli
|
||||
|
||||
months = ~&p/block3'JanFebMarAprMayJunJulAugSepOctNovDec' block2'010203040506070809101112'
|
||||
|
||||
completion =
|
||||
|
||||
-:~& ~&pllrTXS/block3'SunMonTueWedThuFriSat'--(~&lS months) -- (
|
||||
--','* sep`, 'day,day,sday,nesday,rsday,day,urday',
|
||||
sep`, 'uary,ruary,ch,il,,e,y,ust,tember,ober,ember,ember')
|
||||
|
||||
text_form = sep` ; mat` + completion*+ <.~&hy,~&tth,--','@th,~&ttth>
|
||||
numeric_form = sep` ; mat`-+ <.~&ttth,@tth -: months,~&th>
|
||||
|
||||
#show+
|
||||
|
||||
main = <.text_form,numeric_form> now0
|
||||
|
|
@ -0,0 +1 @@
|
|||
Date(REVERSE+NOMSG+VALUE, '-')
|
||||
31
Task/Date-format/Vedit-macro-language/date-format-2.vedit
Normal file
31
Task/Date-format/Vedit-macro-language/date-format-2.vedit
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Get todays date into #1, #2, #3 and #7
|
||||
#1 = Date_Day
|
||||
#2 = Date_Month
|
||||
#3 = Date_Year
|
||||
#7 = JDate() % 7 // #7 = weekday
|
||||
|
||||
// Convert weekday number (in #7) into word in T-reg 1
|
||||
if (#7==0) { RS(1,"Sunday") }
|
||||
if (#7==1) { RS(1,"Monday") }
|
||||
if (#7==2) { RS(1,"Tuesday") }
|
||||
if (#7==3) { RS(1,"Wednesday") }
|
||||
if (#7==4) { RS(1,"Thursday") }
|
||||
if (#7==5) { RS(1,"Friday") }
|
||||
if (#7==6) { RS(1,"Saturday") }
|
||||
|
||||
// Convert month number (in #2) into word in T-reg 2
|
||||
if (#2==1) { RS(2,"January") }
|
||||
if (#2==2) { RS(2,"February") }
|
||||
if (#2==3) { RS(2,"March") }
|
||||
if (#2==4) { RS(2,"April") }
|
||||
if (#2==5) { RS(2,"May") }
|
||||
if (#2==6) { RS(2,"June") }
|
||||
if (#2==7) { RS(2,"July") }
|
||||
if (#2==8) { RS(2,"August") }
|
||||
if (#2==9) { RS(2,"September") }
|
||||
if (#2==10) { RS(2,"October") }
|
||||
if (#2==11) { RS(2,"November") }
|
||||
if (#2==12) { RS(2,"December") }
|
||||
|
||||
// Display the date string
|
||||
RT(1) M(", ") RT(2) M(" ") NT(#1, LEFT+NOCR) M(",") NT(#3)
|
||||
|
|
@ -0,0 +1 @@
|
|||
RI(1) IT(", ") RI(2) IT(" ") NI(#1, LEFT+NOCR) IT(",") NI(#3)
|
||||
19
Task/Date-format/XPL0/date-format.xpl0
Normal file
19
Task/Date-format/XPL0/date-format.xpl0
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
include c:\cxpl\codes;
|
||||
int CpuReg, Year, Month, Day, DName, MName, WDay;
|
||||
[CpuReg:= GetReg; \access CPU registers
|
||||
CpuReg(0):= $2A00; \DOS system call
|
||||
SoftInt($21);
|
||||
Year:= CpuReg(2);
|
||||
Month:= CpuReg(3) >> 8;
|
||||
Day:= CpuReg(3) & $FF;
|
||||
WDay:= CpuReg(0) & $FF;
|
||||
IntOut(0, Year); ChOut(0, ^-);
|
||||
if Month<10 then ChOut(0, ^0); IntOut(0, Month); ChOut(0, ^-);
|
||||
if Day<10 then ChOut(0, ^0); IntOut(0, Day); CrLf(0);
|
||||
DName:= ["Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday"];
|
||||
MName:= [0, "January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December"];
|
||||
Text(0, DName(WDay)); Text(0, ", "); Text(0, MName(Month)); Text(0, " ");
|
||||
IntOut(0, Day); Text(0, ", "); IntOut(0, Year); CrLf(0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue