12-07-2009
Quote:
Originally Posted by
jim mcnamara
IF you set the system date using the date command ( assuming you are not running ntpd or xtnpd) then that will change the system time.
Anything else is just sort of silly. You can use TZ to mess around with a few days, as you have discovered, but it is NOT changing the system date: that is set as the number of seconds since Jan 1 1970. To truly change the date you have to reset system time with the date command - which is NOT a great idea. crontab can get confused, for example.
What are you really trying to accomplish - answer does not include not playing with TZ?
Thanks for replying.
I am trying to test some logic that relies on the unix date being the last calendar day of the month. Obviously if I run this now the system date will be Dec 7 2009 - I want to test the script when the date is Nov 30 2009 or Dec 31 2009.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi all,
I need to syncronize a Solaris client with a QNX Server, modifying the client date, I need any alternative to set the sistem date (client Solaris) but i can't use commands date -a XXX (XXX are the time in seconds) and can't use rdate and ntp.
How can I do It? :confused: (2 Replies)
Discussion started by: ulisses0205
2 Replies
2. Shell Programming and Scripting
I am currently running the following Korn shell script which works fine:
#!/usr/bin/ksh
count=`db2 -x "select count(*) from schema.tablename"`
echo "count"
I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies
3. Shell Programming and Scripting
Hi,
Anybody knows how to get what date was 28 days ago of the current system date through UNIX script.
Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)
Discussion started by: kandi.reddy
15 Replies
4. UNIX for Dummies Questions & Answers
Hello gurus,
I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4:
NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies
5. UNIX for Dummies Questions & Answers
Hi Guys,
Anyone who knows how to compare the current date with the a file containing a date, say for example I have a file that looks like this:
Command was launched from partition 0.
------------------------------------------------
Executing command in server server6
Fri Dec 16... (7 Replies)
Discussion started by: rymnd_12345
7 Replies
6. Shell Programming and Scripting
Hi! I am trying to read a file and every line has a specific date as one of its fields.
I want to take that date and compare it to the date today plus 6 days.
while read line
do
date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD
if ; then
...proceed commands
... (1 Reply)
Discussion started by: kokoro
1 Replies
7. SCO
Hi! All,
I am trying to reset the date and time since the change in time over the weekend. I cannot issue the command date -t 201703131330.
The system gives me an error invalid option.
This happens on my SCO OpenServer 5.0.7 and 5.0.6. Do anyone have an idea why? I even tried using... (6 Replies)
Discussion started by: trolley
6 Replies
8. Shell Programming and Scripting
i try to set linux date & time in specific format but it keep giving me error
Example :
date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
or
date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
keep giving me this error :
date: invalid date ‘19-01-2017 00:05:01'
Please use CODE tags... (7 Replies)
Discussion started by: umen
7 Replies
9. UNIX for Beginners Questions & Answers
Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt .
I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies
10. Answers to Frequently Asked Questions
I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update. (1 Reply)
Discussion started by: Stuti
1 Replies
LEARN ABOUT OSX
apr::date
apache_mod_perl-108~358::mod_perl-2.0.7::docs::api::APR:UsereContributed Perl Docuapache_mod_perl-108~358::mod_perl-2.0.7::docs::api::APR::Date(3)
NAME
APR::Date - Perl API for APR date manipulating functions
Synopsis
use APR::Date ();
# parse HTTP-complient date string
$date_string = 'Sun, 06 Nov 1994 08:49:37 GMT';
$date_parsed = APR::Date::parse_http($date_string);
# parse RFC822-complient date string
$date_string = 'Sun, 6 Nov 94 8:49:37 GMT';
$date_parsed = APR::Date::parse_rfc($date_string);
Description
"APR::Socket" provides the Perl interface to APR date manipulating functions.
API
"APR::Date" provides the following functions and/or methods:
"parse_http"
Parse HTTP date strings
$date_parsed = parse_http($date_string);
arg1: $date_string ( string )
The date string can be in one of the following formats:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
refer to RFC2616 for the details (GMT is assumed, regardless of the used timezone).
ret: $date_parsed ( number )
the number of microseconds since 1 Jan 1970 GMT, or 0 if out of range or if the date is invalid.
since: 2.0.00
Remember to divide the return value by 1_000_000 if you need it in seconds.
"parse_rfc"
Parse a string resembling an RFC 822 date. It's meant to be lenient in its parsing of dates. Hence, this will parse a wider range of
dates than "parse_http()".
$date_parsed = parse_rfc($date_string);
arg1: $date_string ( string )
The date string can be in one of the following formats:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
Sun, 6 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sun, 06 Nov 94 08:49:37 GMT ; RFC 822
Sun, 6 Nov 94 08:49:37 GMT ; RFC 822
Sun, 06 Nov 94 08:49 GMT ; Unknown [drtr@ast.cam.ac.uk]
Sun, 6 Nov 94 08:49 GMT ; Unknown [drtr@ast.cam.ac.uk]
Sun, 06 Nov 94 8:49:37 GMT ; Unknown [Elm 70.85]
Sun, 6 Nov 94 8:49:37 GMT ; Unknown [Elm 70.85]
ret: $date_parsed ( number )
the number of microseconds since 1 Jan 1970 GMT, or 0 if out of range or if the date is invalid.
since: 2.0.00
Remember to divide the return value by 1_000_000 if you need it in seconds.
See Also
mod_perl 2.0 documentation.
Copyright
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
Authors
The mod_perl development team and numerous contributors.
perl v5.16.2 2011-02-07 apache_mod_perl-108~358::mod_perl-2.0.7::docs::api::APR::Date(3)