I don't have access to a Linux system (so the following is untested), but the following should give you the Timezone string that applies to midnight at the start of the given date:
Note that on dates when there is a switch to or from daylight savings time, the answer for those two days each year (in areas where daylight savings time is observed) is not a constant for the entire day. That is why it is important to specify a specific time for the test rather than assume that the answer applies to the entire day.
I need the date validation. I searched in the google but i didn't find my requirements.
requirements:
1) user has to enter the date in YYYY/MM/DD format
2) MM validations
3) DD validations.
and if the month is april it should allow 30 days only and for May month it should allow 31 days like... (1 Reply)
Is there a way to figure out if given date is in DST or in EST? So imagine a shell script is_date_dst.sh
sh is_date_dst.sh 2009-03-02 would return 0 and
sh is_date_dst.sh 2009-03-22 would return 1
This script should not assume the timezone of the machine it runs on, but only the date passed... (7 Replies)
Hello,
I have been trying to figure out how to solve this problem and I have run into a dead end. I am trying to parse a text file that gives me a date and I need to read it into SQL server 2005 but SQL can't figure out its a time unless I put it in a different format. This is how my text file... (3 Replies)
i have few files generated everyday with a date stamp. Sometimes it happens that if the files are generated late i.e after 00:00 hrs the date stamp will be of the next day.
example:
110123_file1
110123_file2
110123_file3
110124_file4
in the above example file4 is also for the previous... (2 Replies)
I have a script to detect if a host is pingable or not. The problem is that I would like it to put the nonpingable hosts in one file and the pingable hosts in another. I have come up with this so far:
for ip in `cat /tmp/testlist2`; do ping -c 3 $ip >/dev/null && echo "$ip is up" || echo "$ip... (5 Replies)
I am trying to create a script that will accept multi input from the user (really just me), then execute those command on a remote device.
My question is if the I enter "No" at the confirmation point "Are these statements correct y or n ?", what is the best way to go back and start over ? I... (3 Replies)
Need a ksh script to get the files that were created or modified in a directory on a particular date entered by the user.
For example if a directory contains files as below :
> ll
total 41
-rw-rw-r-- 1 psn psn 199 Aug 23 07:06 psn_roll.sh
-rw-rw-r-- 1 psn psn ... (10 Replies)
I need to get the next day's date of the user entered date
for example:
Enter date (yyyy/mm/yy):
2013/10/08I need to get the next day's date of the user entered date
Desired Output:
2013/10/09Though there are ways to achieve this is Linux or Unix environment (date command) ,I need to... (1 Reply)
Hi Experts,
path=/db/files/
format=$1
User can enter any file format.compare the user file format with actual file format existed in the directory /db/files. User enter all characters as "A" apart from date format.
example1: user will be entering the file format AAA_AA_YYYYMMDD.AAA
Actual... (6 Replies)
Say I have this line:
read -p "Enter 3 numbers: " num1 num2 num3;
I want to write a while loop that repeatedly asks for input if the number of inputs entered is not equal to 3.
I don't know the correct command to find the number of inputs entered. Help, please? (4 Replies)
Discussion started by: jejemonx
4 Replies
LEARN ABOUT DEBIAN
parsedate
PARSEDATE(3) Library Functions Manual PARSEDATE(3)NAME
parsedate - convert time and date string to number
SYNOPSIS
#include <sys/types.h>
typedef struct _TIMEINFO {
time_t time;
long usec;
long tzone;
} TIMEINFO;
time_t
parsedate(text, now)
char *text;
TIMEINFO *now;
DESCRIPTION
Parsedate converts many common time specifications into the number of seconds since the epoch -- i.e., a time_t; see time(2).
Parsedate returns the time, or -1 on error. Text is a character string containing the time and date. Now is a pointer to the time that
should be used for calculating relative dates. If now is NULL, then GetTimeInfo in libinn(3) is used to obtain the current time and time-
zone.
The character string 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], yyyy/mm/dd, monthname dd[, yy], dd monthname
[yy], and day, dd monthname yy. The default year is the current year. If the year is less then 100, then 1900 is added to it; if
it is less then 21, then 2000 is added to it.
relative time
A specification relative to the current time. The format is number unit; acceptable units are year, 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.
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.
Parsedate ignores case when parsing all words; unknown words are taken to be unknown timezones, which are treated as GMT. The names of the
months and days of the week can be abbreviated to their first three letters, with optional trailing period. Periods are ignored in any
timezone or meridian values.
BUGS
Parsedate does not accept all desirable and unambiguous constructions. Semantically incorrect dates such as ``February 31'' are accepted.
Daylight savings time is always taken as a one-hour change which is wrong for some places. The daylight savings time correction can get
confused if parsing a time within an hour of when the reckoning changes, or if given a partial date.
HISTORY
Originally written by Steven M. Bellovin <smb@research.att.com> while at the University of North Carolina at Chapel Hill and distributed
under the name getdate.
A major overhaul was done by Rich $alz <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
It was further revised (primarily to remove obsolete constructs and timezone names) a year later by Rich (now <rsalz@osf.org>) for Inter-
NetNews, and the name was changed. This is revision 1.10, dated 1993/01/29.
SEE ALSO date(1), ctime(3), libinn(3), time(2).
PARSEDATE(3)