Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

date(1) [plan9 man page]

DATE(1) 						      General Commands Manual							   DATE(1)

date - print the date SYNOPSIS
date [ option ] [ seconds ] DESCRIPTION
Print the date, in the format Tue Aug 16 17:03:52 CDT 1977 The options are -u Report Greenwich Mean Time (GMT) rather than local time. -n Report the date as the number of seconds since the epoch, 00:00:00 GMT, January 1, 1970. The conversion from Greenwich Mean Time to local time depends on the $timezone environment variable; see ctime(2). If the optional argument seconds is present, it is used as the time to convert rather than the real time. FILES
/env/timezone Current timezone name and adjustments. /adm/timezone A directory containing timezone tables. /adm/timezone/local Default timezone file, copied by init(8) into /env/timezone. SOURCE
/sys/src/cmd/date.c DATE(1)

Check Out this Related Man Page

gettimeofday(2) 						System Calls Manual						   gettimeofday(2)

       gettimeofday, settimeofday - get or set date and time

       #include <sys/time.h>

       gettimeofday(tp, tzp)
       struct timeval *tp;
       struct timezone *tzp;

       settimeofday(tp, tzp)
       struct timeval *tp;
       struct timezone *tzp;

       The  system  call returns the system's notion of the current Greenwich time and the current time zone.  Time returned is expressed relative
       in seconds and microseconds since midnight January 1, 1970.

       The structures pointed to by tp and tzp are defined in <sys/time.h> as:

       struct timeval {
	    long tv_sec;	/* seconds since Jan. 1, 1970 */
	    long tv_usec;  /* and microseconds */

       struct timezone {
	    int  tz_minuteswest;     /* of Greenwich */
	    int  tz_dsttime;	/* type of dst correction to apply */

       The timezone structure indicates the local time zone (measured in minutes of time westward from Greenwich), and a flag  that,  if  nonzero,
       indicates that Daylight Saving time applies locally during the appropriate part of the year.

       Only the superuser can set the time of day.

Return Values
       A  0  return  value  indicates  that  the call succeeded.  A -1 return value indicates an error occurred, and in this case an error code is
       stored into the global variable errno.

       The call fails under the following conditions:

       [EFAULT]       An argument address referenced invalid memory.

       [EPERM]	      A user other than the superuser attempted to set the time.

See Also
       date(1), stime(2), ctime(3)


10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying files with the latest date

Hi All, I have a situation where I need to copy the files having the latest date. For example I have a file by name bas100e1_jun05. I need to copy it to bas100e1. But when a file by name bas100e1_jul05 is put in the same directory the script should copy the file having the latest month which... (34 Replies)
Discussion started by: shashi_kiran_v
34 Replies

2. Shell Programming and Scripting

Challenging Compare and validate question -- plus speed.

I have a tab delimited HUGE file (13 million records) with Detail, Metadata and Summary records. Sample File looks like this M BESTWESTERN 4 ACTIVITY_CNT_L12 A 3 M AIRTRAN 4 ACTIVITY_CNT_L12 A 3 D BESTWESTERN FIRSTNAME LASTNAME 209 N SANBORN AVE D BESTWESTERN FIRSTNAME LASTNAME 6997... (25 Replies)
Discussion started by: madhunk
25 Replies

3. Shell Programming and Scripting

grep a log file between 2 dates

Hi Currently I can grep a log file with the following command: $results = `grep -A 2 '^$date.$time.*' $log`; and the following arguments: $date = 2007/04/25 $time = 16:07 Log example: 2007/04/25 16:07:12.145701 2007/05/25 14:07:12.145701 2007/05/25 17:07:12.145701 2007/06/25... (37 Replies)
Discussion started by: Epiphone
37 Replies

4. Shell Programming and Scripting

Date format

Hi, I need to conver the date format to binary and then subract it by one which will result me an output with yesterdays date and use it.. So that i will use the out and delete all the folders which are of minus one days.i.e if today is 2010-03-18 (this is a folder format at some xyz location).... (59 Replies)
Discussion started by: j_panky
59 Replies

5. Shell Programming and Scripting

Perl Script to check file date and size

Hi guys, i am new to perl. I started reading the perl documents and try to come up with some logic. I am trying to create a script that would go into a location, search for todays files, then searches for all .txt files from today. If todays not found, its an error If file size is less... (26 Replies)
Discussion started by: DallasT
26 Replies

6. Linux

Rolling Back an Update

I am writing a software product and hope that it will work on a variety of Linux distributions. At the moment, I am trying to create some kind of Linux version of patches/upgrades of installed software. Gathering information on available updates isn't hard, nor is installation of updates, but I... (27 Replies)
Discussion started by: Brandon9000
27 Replies

7. Shell Programming and Scripting

Date command

Just writing a script as part of a backup procedure to use a data file 7 days previous if there has not been one sent over. Got stuck on trying to get the date command to insert the date from 7 days ago i.e. todays date is 12/09/10 7 days ago would be 12/09/03 I would want the date command... (30 Replies)
Discussion started by: 02JayJay02
30 Replies

8. Ubuntu

Date format in the files written by syslogd

Hi, Below is what i am seeing in /var/log/messages on ubuntu machine. 2013-01-14T18:29:39.319736+00:00 test01 ldap-mail: test1 Jan 14 18:29:39 test01 ldap-mail: test2 2013-01-14T18:29:39.320792+00:00 test01 ldap-mail: test3 Jan 14 18:29:39 test01 ldap-mail: test4But on other ubuntu... (29 Replies)
Discussion started by: prash358
29 Replies

9. Solaris

Update OpenBoot Prom from CD

Hello, I have a sun v880 that i got from ebay for cheap as a way to to learn Solaris and sun hardware in general. The machine currently has OBP 4.7.0 2002/10/25 and i was wondering if there was a way to update the prom with out and active solaris install, as currently when i proceed with the... (29 Replies)
Discussion started by: pvibien
29 Replies

10. What is on Your Mind?

Update to Navbar - Member Info and Avatars

Hey, I moved the user information in the top right on the navbar to side panel and replace it with a clickable avatar image. If you have an avatar, you will see your avatar and if you don't you will see some default one (will change it to something better later). If you have any notification... (53 Replies)
Discussion started by: Neo
53 Replies

Featured Tech Videos