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
CTIME(3) Library Functions Manual CTIME(3)
NAME
ctime, localtime, gmtime, asctime, timezone, tzset - convert date and time to ASCII
SYNOPSIS
void tzset()
char *ctime(clock)
time_t *clock;
#include <time.h>
char *asctime(tm)
struct tm *tm;
struct tm *localtime(clock)
time_t *clock;
struct tm *gmtime(clock)
time_t *clock;
char *timezone(zone, dst)
DESCRIPTION
Tzset uses the value of the environment variable TZ to set up the time conversion information used by localtime.
If TZ does not appear in the environment, the TZDEFAULT file (as defined in tzfile.h) is used by localtime. If this file fails for any
reason, the GMT offset as provided by the kernel is used. In this case, DST is ignored, resulting in the time being incorrect by some
amount if DST is currently in effect. If this fails for any reason, GMT is used.
If TZ appears in the environment but its value is a null string, Greenwich Mean Time is used; if TZ appears and begins with a slash, it is
used as the absolute pathname of the tzfile(5)-format file from which to read the time conversion information; if TZ appears and begins
with a character other than a slash, it's used as a pathname relative to the system time conversion information directory, defined as TZDIR
in the include file tzfile.h. If this file fails for any reason, GMT is used.
Programs that always wish to use local wall clock time should explicitly remove the environmental variable TZ with unsetenv(3).
Ctime converts a long integer, pointed to by clock, such as returned by time(2) into ASCII and returns a pointer to a 26-character string
in the following form. All the fields have constant width.
Sun Sep 16 01:03:52 1973
Localtime and gmtime return pointers to structures containing the broken-down time. Localtime corrects for the time zone and possible day-
light savings time; gmtime converts directly to GMT, which is the time UNIX uses. Asctime converts a broken-down time to ASCII and returns
a pointer to a 26-character string.
The structure declaration from the include file is:
struct tm {
int tm_sec; /* 0-59 seconds */
int tm_min; /* 0-59 minutes */
int tm_hour; /* 0-23 hour */
int tm_mday; /* 1-31 day of month */
int tm_mon; /* 0-11 month */
int tm_year; /* 0- year - 1900 */
int tm_wday; /* 0-6 day of week (Sunday = 0) */
int tm_yday; /* 0-365 day of year */
int tm_isdst; /* flag: daylight savings time in effect */
char **tm_zone; /* abbreviation of timezone name */
long tm_gmtoff; /* offset from GMT in seconds */
};
Tm_isdst is non-zero if a time zone adjustment such as Daylight Savings time is in effect.
Tm_gmtoff is the offset (in seconds) of the time represented from GMT, with positive values indicating East of Greenwich.
Timezone remains for compatibility reasons only; it's impossible to reliably map timezone's arguments (zone, a "minutes west of GMT" value
and dst, a "daylight saving time in effect" flag) to a time zone abbreviation.
If the environmental string TZNAME exists, timezone returns its value, unless it consists of two comma separated strings, in which case the
second string is returned if dst is non-zero, else the first string. If TZNAME doesn't exist, zone is checked for equality with a built-in
table of values, in which case timezone returns the time zone or daylight time zone abbreviation associated with that value. If the
requested zone does not appear in the table, the difference from GMT is returned; e.g. in Afghanistan, timezone(-(60*4+30), 0) is appropri-
ate because it is 4:30 ahead of GMT, and the string GMT+4:30 is returned. Programs that in the past used the timezone function should
return the zone name as set by localtime to assure correctness.
FILES
/usr/share/zoneinfotime zone information directory
/etc/localtime local time zone file
SEE ALSO
gettimeofday(2), getenv(3), time(3), tzfile(5), environ(7)
NOTE
The return values point to static data whose content is overwritten by each call. The tm_zone field of a returned struct tm points to a
static array of characters, which will also be overwritten at the next call (and by calls to tzset).
4th Berkeley Distribution November 27, 1996 CTIME(3)