Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: NT Script ?

RE: NT Script ?

From: Mercadante, Thomas F <NDATFM_at_labor.state.ny.us>
Date: Wed, 27 Jun 2001 05:18:53 -0700
Message-ID: <F001.00339BAF.20010627045633@fatcity.com>

Kevin,

Sorry, I thought I sent you what I had. The script below will return the hour and minute, but getting the seconds are difficult, unless you use a Perl script. Secondly, the script below does not distinguish between 8AM and 8PM - both are returned as 8, another reason that I don't think it is completely usefull.

rem *********** TOTIME.BAT *************************
rem echo off
IF NOT '%1'=='' GOTO SetEnvVars
for /F "delims=:,a,p tokens=1-4" %%i in ('time/T') do totime.BAT %%i %%j %%k
%%l
GOTO Done
:SetEnvVars
:: set DayOfWeek=%1
set Hour=%1
set Min=%2
set Sec=%3
:Done
rem ************************************************

Below is a Perl script I use that created both date and time environmental variables. Run the Perl script, and then the Today.Bat file that it produces within the calling NT bat script to setup the environmental's.

#Program Name : Today.pl
#Author : Thomas Mercadante
# 1/18/2000
#Purpose : This program will produce an NT BAT file that
# may be called by other BAT programs to establish
# an NT environmental variable that will contain
# the following environmental variables:
#
# month Mmm Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# day Ddd Mon, Tue Wed Thu Fri Sat Sun
# year 2000
# time HHMMSS
# date nn 1,2,3,4,5,6,7,8,9,10 etc
# today Month_date_year
#

$time=localtime(time);
@today=split(/ /,$time);

$day=$today[0];
$month=$today[1];
$date=$today[2];

 if ($date eq '')
  {
    $date=$today[3];

# $time=$today[4];

    $year=$today[5];
    @clock=split(/:/,$today[4]);

    $hour=$clock[0];
    $min=$clock[1];
    $sec=$clock[2];

  } else
  {
# $time=$today[3];

    @clock=split(/:/,$today[3]);

    $hour=$clock[0];
    $min=$clock[1];
    $sec=$clock[2];
    $year=$today[4];

  }
print "\@set today=".$month. "_" .$date. "_" .$year. "\n";
print "\@set month=".$month."\n";
print "\@set day=".$day."\n";
print "\@set year=".$year."\n";
print "\@set time=".$hour.$min.$sec. "\n";
print "\@set date=".$date."\n";


Hope these help.

Tom Mercadante
Oracle Certified Professional

-----Original Message-----
Sent: Tuesday, June 26, 2001 5:33 PM
To: Multiple recipients of list ORACLE-L

Hi all,

        Was wondering if anyone of the brains out there would know how to add the
hour and minute to this beautiful little script that Tom Mercadante provided me with? Not that Tom couldn't do it himself, he just didn't, I didn't ask for it the first time that I requested such a script.

        Thanks again Tom, this will help me out beautifully:)

rem ************************************************
rem echo off
IF NOT '%1'=='' GOTO SetEnvVars
for /F "delims=/ tokens=1-4" %%i in ('date /t') do today.BAT %%i %%j %%k %%l
GOTO Done
:SetEnvVars
:: set DayOfWeek=%1
set Month=%2
set Day=%3
set Year=%4
:Done
rem ************************************************


Sincerely,
Kevin Kostyszyn
DBA
Dulcian, Inc
www.dulcian.com
kevin_at_dulcian.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Kevin Kostyszyn
  INET: kevin_at_dulcian.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mercadante, Thomas F
  INET: NDATFM_at_labor.state.ny.us

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Jun 27 2001 - 07:18:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US