DATE TIME formatting

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support DATE TIME formatting
# 8  
Old 01-19-2013
Thank you so much RudiC you are always rocking
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need Date Formatting help

Hi, How can i store the date + time from the output of the ls command in loop in a variable date1? -rw-rw---- 1 user1 admin 500002 Jan 2 21:24 P002607.cssI then want to convert Jan 2 21:24 to this date format 2014-01-02 21:24:00 and save it in date2 variable. Then i would like to add... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. UNIX for Dummies Questions & Answers

Formatting date time in unix using perl breaks

while read l do vTimeCreated=`perl -e '@d=localtime ((stat(shift))); printf "%02d-%02d-%04d %02d:% 02d:%02d\n", $d,$d+1,$d+1900,$d,$d,$d' ${l}` echo "${l} || ${vTimeCreated}" >> ${fPrefx}_Output_Files_${vDate}.txt done < servername.txt Using the above code to format date time for each of... (5 Replies)
Discussion started by: HeadBang
5 Replies

3. Shell Programming and Scripting

Formatting date time in unix

while read l do vTimeCreated=`perl -e '@d=localtime ((stat(shift))); printf "%02d-%02d-%04d %02d:% 02d:%02d\n", $d,$d+1,$d+1900,$d,$d,$d' ${l}` echo "${l} || ${vTimeCreated}" >> ${fPrefx}_Output_Files_${vDate}.txt done < servername.txt Using the above code to format date time for each of the... (0 Replies)
Discussion started by: HeadBang
0 Replies

4. Shell Programming and Scripting

Formatting date

Hi all Y=`date +'%Y'` M=`date +'%m'` D=`date +'%d'` if && ;then yesterday=$Y$M`expr $D + 30` echo $yesterday else if && ; then yesterday=$Y$M`expr $D + 29` echo $yesterday else if ; then yesterday=$Y$M`expr $D + 27` echo $yesterday else yesterday=$Y$M`expr $D - 1` echo... (8 Replies)
Discussion started by: ultimatix
8 Replies

5. Shell Programming and Scripting

Formatting a date

Hi, the date value retrieved by a parameter from the table is of the format dd/mm/yyyy. please let me know how to convert this to YYYYMMDD using sed thanks (4 Replies)
Discussion started by: swasid
4 Replies

6. OS X (Apple)

Date Formatting, etc.

Hi - I'm using GeekTool to customize my desktop in OS X 10.5.8 I'm a complete novice as far as UNIX commands, just know enough to be dangerous. I have a command entered as a Shell to display my events from iCal: This makes my events show something like this: While this is... (1 Reply)
Discussion started by: patricksprague
1 Replies

7. Shell Programming and Scripting

date formatting

Hi i need to have the date in the format like dd-mon-yyyy my script goes like this #!/usr/bin/bash for f in /space/can /home/lbs/current/externalcdrbackup/L_CDR_Configuration/1/200903122* ; do awk '{sum++;}END{for(i in sum) {print d,h,m,i, sum}}' "d=$(date +'%m-%d-%Y')" "h=$(date +'%H')"... (8 Replies)
Discussion started by: aemunathan
8 Replies

8. UNIX for Dummies Questions & Answers

Date formatting

Running bash how do I input the date in the command line like 3/20/90 and get an output formmated like March, 20 1990. (8 Replies)
Discussion started by: knc9233
8 Replies

9. Shell Programming and Scripting

date formatting

Date format MM/DD/YYYY required is YYYYMMDD, I tried using sed but could not get it any help please. (4 Replies)
Discussion started by: mgirinath
4 Replies

10. Shell Programming and Scripting

Formatting date

i need date in the following format December 14, 2005. With date +"%b %d, %Y" command i am getting the following output :- Dec 14, 2005. can anyone pls tell me how to get the full month name (2 Replies)
Discussion started by: radhika03
2 Replies
Login or Register to Ask a Question
TIME2POSIX(3)						   BSD Library Functions Manual 					     TIME2POSIX(3)

NAME
time2posix, posix2time -- convert seconds since the Epoch LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <time.h> time_t time2posix(time_t t); time_t posix2time(time_t t); DESCRIPTION
IEEE Std 1003.1-1988 (``POSIX.1'') legislates that a time_t value of 536457599 shall correspond to "Wed Dec 31 23:59:59 GMT 1986." This effectively implies that POSIX time_t's cannot include leap seconds and, therefore, that the system time must be adjusted as each leap occurs. If the time package is configured with leap-second support enabled, however, no such adjustment is needed and time_t values continue to increase over leap events (as a true `seconds since...' value). This means that these values will differ from those required by POSIX by the net number of leap seconds inserted since the Epoch. Typically this is not a problem as the type time_t is intended to be (mostly) opaque--time_t values should only be obtained-from and passed- to functions such as time(3), localtime(3), mktime(3) and difftime(3). However, IEEE Std 1003.1-1988 (``POSIX.1'') gives an arithmetic expression for directly computing a time_t value from a given date/time, and the same relationship is assumed by some (usually older) appli- cations. Any programs creating/dissecting time_t's using such a relationship will typically not handle intervals over leap seconds cor- rectly. The time2posix() and posix2time() functions are provided to address this time_t mismatch by converting between local time_t values and their POSIX equivalents. This is done by accounting for the number of time-base changes that would have taken place on a POSIX system as leap sec- onds were inserted or deleted. These converted values can then be used in lieu of correcting the older applications, or when communicating with POSIX-compliant systems. The time2posix() function is single-valued. That is, every local time_t corresponds to a single POSIX time_t. The posix2time() function is less well-behaved: for a positive leap second hit the result is not unique, and for a negative leap second hit the corresponding POSIX time_t does not exist so an adjacent value is returned. Both of these are good indicators of the inferiority of the POSIX representation. The following table summarizes the relationship between time_t and its conversion to, and back from, the POSIX representation over the leap second inserted at the end of June, 1993. DATE TIME T X=time2posix(T) posix2time(X) 93/06/30 23:59:59 A+0 B+0 A+0 93/06/30 23:59:60 A+1 B+1 A+1 or A+2 93/07/01 00:00:00 A+2 B+1 A+1 or A+2 93/07/01 00:00:01 A+3 B+2 A+3 A leap second deletion would look like... DATE TIME T X=time2posix(T) posix2time(X) ??/06/30 23:59:58 A+0 B+0 A+0 ??/07/01 00:00:00 A+1 B+2 A+1 ??/07/01 00:00:01 A+2 B+3 A+2 [Note: posix2time(B+1) => A+0 or A+1] If leap-second support is not enabled, local time_t's and POSIX time_t's are equivalent, and both time2posix() and posix2time() degenerate to the identity function. SEE ALSO
difftime(3), localtime(3), mktime(3), time(3) BSD
September 11, 2005 BSD