Sponsored Content
Full Discussion: DATE TIME formatting
Homework and Emergencies Emergency UNIX and Linux Support DATE TIME formatting Post 302754851 by nex_asp on Friday 11th of January 2013 09:26:04 AM
Old 01-11-2013
DATE TIME formatting

can anyone one help me....to make date and time format...to following format for my file


Code:
Code:
DATE                           TIME DD- MON- YEAR         24 Hours

I have a need of format like this

12-Jan-2012 in one column, then time in 24 Hours in another column....please help...me...

currently we are upgrading our database....kindly help to make standard format...

our database containing format like this


Code:
Code:
DD-MON-YEAR MON-DAY-YEAR YEAR-MON-DAY DD/MON/YEAR MON/DAY/YEAR YEAR/MON/DAY

some files containing month name, some number...

Code:
and time format
both 12 and 24 hours are mixed

script has to read current format of date and time and then write to new file with standard format

Awaiting for help...

here is my data

Code:
DATE,PR,ST,ONC,NOD
7/19/1979 18:00,748,1,43,1
7/19/1979 18:00,748,1,43,1
7/19/1979 18:00,748,1,43,1
7/19/1979 18:00,748,1,43,1
7/19/1979 18:00,748,1,43,1
7/19/1979 18:00,748,1,43,1
7/19/1979 06:00:00 AM,748,1,43,1
25/1/1979 06:00:00 AM,748,1,43,1
20/1/1979 06:00:00 AM,748,1,43,1
31/9/1979 06:00:00 AM,748,1,43,1
20/1/1979 06:00:00 AM,748,1,43,1
31/9/1979 06:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,748,1,43,1
25-Jul-1979 03:00:00 AM,749,2,44,2
25-Jul-1979 03:00:00 AM,750,3,45,3
Feb-08-1988 12:05:00 PM,751,4,46,4
Feb-08-1988 12:05:00 PM,752,5,47,5
08-Feb-1988 18:00,753,6,48,6
08-Feb-1988 18:00,754,7,49,7
25-1-1979 06:00:00 AM,748,1,43,1
20-1-1979 06:00:00 AM,748,1,43,1
1-15-1979 06:00:00 AM,748,1,43,1
2-19-1979 06:00:00 AM,748,1,43,1

those who know please do favour for me...

Last edited by nex_asp; 01-11-2013 at 10:28 AM.. Reason: code tag
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
in.tnamed(1M)						  System Administration Commands					     in.tnamed(1M)

NAME
in.tnamed, tnamed - DARPA trivial name server SYNOPSIS
/usr/sbin/in.tnamed [-v] DESCRIPTION
in.tnamed is a server that supports the DARPA Name Server Protocol. The name server operates at the port indicated in the "name" service description (see services(4)), and is invoked by inetd(1M) when a request is made to the name server. OPTIONS
-v Invoke the daemon in verbose mode. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWtnamd | +-----------------------------+-----------------------------+ SEE ALSO
svcs(1), uucp(1C), inetadm(1M), inetd(1M), svcadm(1M), services(4), attributes(5), smf(5) Postel, Jon, Internet Name Server, IEN 116, SRI International, Menlo Park, California, August 1979. NOTES
The protocol implemented by this program is obsolete. Its use should be phased out in favor of the Internet Domain Name Service (DNS) pro- tocol. The in.tnamed service is managed by the service management facility, smf(5), under the service identifier: svc:/network/tname Administrative actions on this service, such as enabling, disabling, or requesting restart, can be performed using svcadm(1M). Responsibil- ity for initiating and restarting this service is delegated to inetd(1M). Use inetadm(1M) to make configuration changes and to view config- uration information for this service. The service's status can be queried using the svcs(1) command. SunOS 5.10 11 Aug 2004 in.tnamed(1M)
All times are GMT -4. The time now is 02:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy