Help me! Perlでの日時取得について


[ Follow Ups ] [ Post Followup ] [ DIGIWEB 日本語Users' BBS ] (PR) [レンタルサーバー]

Posted by Yoshihito Tsuji on June 10日 (1996年) 00時33分40秒:

はじめまして、
海外サーバーに初進出したものの、このBBSを見させていただいて
ちょっとビビってしまっている今日この頃です。(^^;


さて、のっけから質問で申し訳ないのですが、今まで日本国内サーバーで
使っていたスクリプトで日時取得が当然の如くローカルタイム表示になってしまい
困っています。
英語版BBSでPerlでの日時取得に対してのアドバイスを頂いていながら
使い道が分からず困っています。
#Perlや言語と呼ばれるモノにはめっぽう弱い私...(T_T)

以下の「ctime.pl」は友人から紹介して貰った日時刻取得スクリプトです。
どのようにすればJSTで表示出来るようになるのでしょうか?


あと、以下のようなSSIで日付&時間をJSTで表示するのは
どうすればいいのでしょうか?


#日本語BBS開設に感謝です!私もInterNicからの請求は気長に待ってみます。

---------------------------------ctime.pl-------------------------------------
$Date = &ctime(time);CONFIG: {
package ctime; @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
@MoY = ('Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec');}sub ctime {
package ctime; local($time) = @_;
local($[) = 0; local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);

# Determine what time zone is in effect.
# Use GMT if TZ is defined as null, local time if TZ undefined.
# There's no portable way to find the system default timezone.

$TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'GMT' ) : '';
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
($TZ eq 'GMT') ? gmtime($time) : localtime($time);

# Hack to deal with 'PST8PDT' format of TZ
# Note that this can't deal with all the esoteric forms, but it
# does recognize the most common: [:]STDoff[DST[off][,rule]]

if($TZ=~/^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/){
$TZ = $isdst ? $4 : $1; }
$TZ .= ' ' unless $TZ eq ''; $year += 1900;
sprintf("%s %s %2d %2d:%02d:%02d %s%4d\n",
$DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year);}1;
---------------------------------end-------------------------------------------



Follow Ups:



Post a Followup

名前:
メールアドレス:

題名:

内容:

関連URL:
関連URLのタイトル:
関連画像のURL:


[ Follow Ups ] [ Post Followup ] [ DIGIWEB 日本語Users' BBS ]