10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello,
I have many files called day001, day002, day003 and I want to rename them by day20070101, day20070102, etc.
I need to do it for several years and leap years as well.
What is the best way to do it ?
Thank you. (1 Reply)
Discussion started by: Ggg
1 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day.
i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies
3. Shell Programming and Scripting
Hi,
I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it.
For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies
4. Shell Programming and Scripting
I am using the code below modified from a post I saw here regarding having the script write out future dates. The problem is that instead of making 8/1 it makes 7/32! Please help!
yy=`date +%Y`
mm=`date +%m`
dd=`date +%d`
echo "Today is : $yy $mm $dd"
#!/usr/bin/ksh
date '+%m... (5 Replies)
Discussion started by: libertyforall
5 Replies
5. Solaris
Recently i have attended a telephonic interview. As i dont have work experience in solaris i was not able to deliver correct answer for this question.
Your answer will help for the people like me who is looking to become Solaris System administrator. (4 Replies)
Discussion started by: Sesha
4 Replies
6. Shell Programming and Scripting
The date increment worked fine until date reached 25/10, which is DLS change date.
/bin/date --date="091025 1 day" +%y%m%d;
the output is 091025
Is this a bug or something missing from the code ! (3 Replies)
Discussion started by: rajbravo
3 Replies
7. Shell Programming and Scripting
Hi All,
I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this.
My Requirment is as below:
Input for me will be 2000909(YYYYMM)
I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies
8. AIX
Hi guys,
OS: AIX 5.3.0.0
I'm from Portugal and I had problems about Day Light changing time, the hour's changes in first Sunday of November, but it's wrong because in Europe the day light need to change in last Sunday of October. My TZ is
TZ=GMT0BST, that I think BST it's British Summer Time. I... (2 Replies)
Discussion started by: uadm26
2 Replies
9. Shell Programming and Scripting
Our system has an option to supply your timezone in area of world you want to keep time for user transactions and such.
It keeps time zone for user in database as for example -5 for EST.
The problem is we are in EDT -4 (daylight savings time) so the time is displayed wrong.
We can put the... (2 Replies)
Discussion started by: photon
2 Replies
10. Shell Programming and Scripting
Hi ,
I am relatively new to unix...
Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell..
This is very urgent.
Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies
clock(n) Tcl Built-In Commands clock(n)
__________________________________________________________________________________________________________________________________________________
NAME
clock - Obtain and manipulate time
SYNOPSIS
clock option ?arg arg ...?
_________________________________________________________________
DESCRIPTION
This command performs one of several operations that may obtain or manipulate strings or values that represent some notion of time. The
option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are:
clock clicks ?-milliseconds? |
Return a high-resolution time value as a system-dependent integer value. The unit of the value is system-dependent but should be |
the highest resolution clock available on the system such as a CPU cycle counter. If -milliseconds is specified, then the value is |
guaranteed to be of millisecond granularity. This value should only be used for the relative measurement of elapsed time.
clock format clockValue ?-format string? ?-gmt boolean?
Converts an integer time value, typically returned by clock seconds, clock scan, or the atime, mtime, or ctime options of the file
command, to human-readable form. If the -format argument is present the next argument is a string that describes how the date and
time are to be formatted. Field descriptors consist of a % followed by a field descriptor character. All other characters are
copied into the result. Valid field descriptors are:
%% Insert a %.
%a Abbreviated weekday name (Mon, Tue, etc.).
%A Full weekday name (Monday, Tuesday, etc.).
%b Abbreviated month name (Jan, Feb, etc.).
%B Full month name.
%c Locale specific date and time.
%d Day of month (01 - 31).
%H Hour in 24-hour format (00 - 23).
%I Hour in 12-hour format (00 - 12).
%j Day of year (001 - 366).
%m Month number (01 - 12).
%M Minute (00 - 59).
%p AM/PM indicator.
%S Seconds (00 - 59).
%U Week of year (00 - 52), Sunday is the first day of the week.
%w Weekday number (Sunday = 0).
%W Week of year (00 - 52), Monday is the first day of the week.
%x Locale specific date format.
%X Locale specific time format.
%y Year without century (00 - 99).
%Y Year with century (e.g. 1990)
%Z Time zone name.
In addition, the following field descriptors may be supported on some systems (e.g. Unix but not Windows):
%D Date as %m/%d/%y.
%e Day of month (1 - 31), no leading zeros.
%h Abbreviated month name.
%n Insert a newline.
%r Time as %I:%M:%S %p.
%R Time as %H:%M.
%t Insert a tab.
%T Time as %H:%M:%S.
If the -format argument is not specified, the format string "%a %b %d %H:%M:%S %Z %Y" is used. If the -gmt argument is present the
next argument must be a boolean which if true specifies that the time will be formatted as Greenwich Mean Time. If false then the
local timezone will be used as defined by the operating environment.
clock scan dateString ?-base clockVal? ?-gmt boolean?
Convert dateString to an integer clock value (see clock seconds). This command can parse and convert virtually any standard date
and/or time string, which can include standard time zone mnemonics. If only a time is specified, the current date is assumed. If
the string does not contain a time zone mnemonic, the local time zone is assumed, unless the -gmt argument is true, in which case
the clock value is calculated assuming that the specified time is relative to Greenwich Mean Time. -gmt, if specified, affects only
the computed time value; it does not impact the interpretation of -base.
If the -base flag is specified, the next argument should contain an integer clock value. Only the date in this value is used, not
the time. This is useful for determining the time on a specific day or doing other date-relative conversions.
The dateString consists of zero or more specifications of the following form:
time A time of day, which is of the form: hh?:mm?:ss?? ?meridian? ?zone? or hhmm ?meridian? ?zone?. If no meridian is specified,
hh is interpreted on a 24-hour clock.
date A specific month and day with optional year. The acceptable formats are mm/dd?/yy?, monthname dd ?, yy?, dd monthname ?yy?,
day, dd monthname yy, ?CC?yymmdd, ?CC?yy-mm-dd, dd-monthname-?CC?yy. The default year is the current year. If the year is
less than 100, we treat the years 00-68 as 2000-2068 and the years 69-99 as 1969-1999. Not all platforms can represent the |
years 38-70, so an error may result if these years are used.
ISO 8601 point-in-time
An ISO 8601 point-in-time specification, such as CCyymmddThhmmss, where T is the literal T, CCyymmdd hhmmss, or CCyymmd-
dThh:mm:ss.
relative time
A specification relative to the current time. The format is number unit acceptable units are year, fortnight, month, week,
day, hour, minute (or min), and second (or sec). The unit can be specified as a singular or plural, as in 3 weeks. These
modifiers may also be specified: tomorrow, yesterday, today, now, last, this, next, ago.
The actual date is calculated according to the following steps. First, any absolute date and/or time is processed and converted.
Using that time as the base, day-of-week specifications are added. Next, relative specifications are used. If a date or day is
specified, and no absolute or relative time is given, midnight is used. Finally, a correction is applied so that the correct hour
of the day is produced after allowing for daylight savings time differences and the correct date is given when going from the end of
a long month to a short month.
Daylight savings time correction is applied only when the relative time is specified in units of days or more, ie, days, weeks,
fortnights, months or years. This means that when crossing the daylight savings time boundary, different results will be given for
clock scan "1 day" and clock scan "24 hours":
% clock scan "1 day" -base [clock scan 1999-10-31]
941443200
% clock scan "24 hours" -base [clock scan 1999-10-31]
941439600
clock seconds
Return the current date and time as a system-dependent integer value. The unit of the value is seconds, allowing it to be used for
relative time calculations. The value is usually defined as total elapsed time from an ``epoch''. You shouldn't assume the value
of the epoch.
KEYWORDS
clock, date, time
Tcl 8.3 clock(n)