develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000307.005] Date Problem

From:
David Gillen
Date:
March 7, 2000 08:24
Subject:
[ID 20000307.005] Date Problem
Message ID:
1.5.4.32.20000307162312.008c7a80@mailhost
Problem. Perl not showing the day correctly, Eg today is Tue March the 7th,
the program get Tue March the 8th. Seems to be due to the 29 Feb Problem for
this year.

Regards
David Gillen





Example Code: (Don't laugh I know it ugly)

$weekday = (Sun,Mon,Tue,Wed,Thur,Fri,Sat)[(localtime)[6]];
$day =
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,
29,30,31)[(localtime)[3]];
$month =
(January,February,March,April,May,June,July,August,September,October,Novembe
r,December)[(localtime)[3]];
print "It is $weekday the $day th of $month";




Output of perl -V

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=freebsd, osvers=4.0-current, archname=i386-freebsd
    uname='freebsd freefall.freebsd.org 4.0-current freebsd 4.0-current #0:
$Date: 1999/05/05 19:42:40 $'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='undef', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2
release)
    cppflags=''
    ccflags =''
    stdchar='char', d_stdstdio=undef, usevfork=true
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E'
    libpth=/usr/lib
    libs=-lm -lc -lcrypt
    libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.3
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fpic', lddlflags='-shared'


Characteristics of this binary (from libperl):
  Built under freebsd
  Compiled at Jan 25 2000 22:13:05
  @INC:
    /usr/libdata/perl/5.00503/mach
    /usr/libdata/perl/5.00503
    /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.005
    .




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About