Sponsored Content
Top Forums Shell Programming and Scripting Date format YYYY/MM/DD to DD/MM/YYYY Post 302993590 by durden_tyler on Saturday 11th of March 2017 03:46:52 PM
Old 03-11-2017
Quote:
Originally Posted by Roozo
I am getting output of YYYY-MM-DD and want to change this to DD/MM/YYYY.
When am running the query in 'Todd'
Code:
to_date(column_name,'DD/MM/YYYY')

am getting the required o/p of DD/MM/YYYY, But when am executing the same query(Netezza) in linux server(bash) am getting the output of YYYY-MM-DD
...
...
While you can always fix the date format using a scripting language after you get it out of the database, you may want to explore the possibility of getting it in the correct format from the database itself.

- If your database column "column_name" is of datatype "DATE", then try the "to_char" function:

Code:
to_char(column_name,'DD/MM/YYYY')

- If your database column "column_name" is of datatype "TIMESTAMP", then try something like this:

Code:
to_char(date(column_name),'DD/MM/YYYY')

This User Gave Thanks to durden_tyler For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change Date from dd-mmm-yyyy to mm/dd/yyyy

I want to change a date from format dd-mmm-yyyy to mm/dd/yyyy. Is there a way to do this with sed or do you have to write a case statement to convert JAN to 01? Thanks (9 Replies)
Discussion started by: stringzz
9 Replies

2. Shell Programming and Scripting

converting the date field from dd/mm/yyyy to yyyy/mm/dd

How to convert the date field from dd/mm/yyyy to yyyy/mm/dd in unix my script will generate text file which have two fields one is date and another is name of the server for example this is sample date which I have to sort based on older to newer date the problem is when I found out sort will... (4 Replies)
Discussion started by: pareshan
4 Replies

3. UNIX for Dummies Questions & Answers

Format date from MM/DD/YYYY to YYYYMMDD

I have a file with some date columns in MM/DD/YYYY format: SMPBR|DUP-DO NOT USE|NEW YORK||16105|BA5270715|6/6/2007 |MWERNER|109||||JOHN||SMITH|MD|72211118||||||74559|21 WILMINGTON RD||D|11/6/2003|SL# MD CONTACT-LIZ RICHARDS|||0|Y|N||1411458| And I want to convert the date format to: ... (5 Replies)
Discussion started by: ChicagoBlues
5 Replies

4. Shell Programming and Scripting

date and time in mm/dd/yyyy hh:mm format

Frens, I have a logfile which has got manier things in it and somewer in that file i have a date in mm/dd/yyyy hh:mm format.... I just need to get the date and time nothing else.... i have searched in this forum for it but got only date in mm-dd-yyyy format.. but i need to search for... (10 Replies)
Discussion started by: smarty86
10 Replies

5. Shell Programming and Scripting

change date format from yyyy/mm/dd to dd/mm/yyyy

(Attention: Green PHP newbie !) I have an online inquiry form, delivering a date in the form yyyy/mm/dd to my feedback form. If the content passes several checks, the form sends an e-mail to me. All works fine. I just would like to receive the date in the form dd/mm/yyyy. I tried with some code,... (6 Replies)
Discussion started by: keyboarder
6 Replies

6. Shell Programming and Scripting

Converting date DD MM YYYY to DD MON YYYY

Hello, I am writing a script that parses different logs and produces one. In the source files, the date is in DD MM YYYY HH24:MI:SS format. In the output, it should be in DD MON YYY HH24:MI:SS (ie 25 Jan 2010 16:10:10) To extract the dates, I am using shell substrings, i.e.: read line ... (4 Replies)
Discussion started by: Adamm
4 Replies

7. Shell Programming and Scripting

Need date in the format [mm dd yyyy hh AM/PM]

could you please help be on the below code .. Requirement is when i pass the parameter(for below 2) i should get current time -2 hours in the format :wall:.. cur_dt=`$ICEBIN/sqsh -S$DSQUERY -U $BATCHID -P $PASSWD -h -C"select getdate()" | sed '2d'` pr_dt="`$ICEBIN/sqsh -S$DSQUERY -U $BATCHID... (2 Replies)
Discussion started by: karthicss
2 Replies

8. Shell Programming and Scripting

need code for date which is in yyyy-mm-dd format

Hi, I am having one log files. contains som data according to date. And it is going to append .Eg:abc.log contains below data 2011-10-19 abjhgj 2011-10-19 gjhgjgj 2011-10-20 hhhjh 2011-10-20 hhhhjj 2011-10-21 gg . . . 2011-11-24 yyy from log files i want catch only... (2 Replies)
Discussion started by: aish11
2 Replies

9. UNIX for Dummies Questions & Answers

Epoch date to YYYY/MM/DD or MM/DD/YYYY

I've seen a lot of posts on this and have tried the following: echo 1257000000| perl -e '($d,$m,$y)=(localtime(time-86400));$m+=1;$y+=1900;printf "$y/$m/$d\n";' But I am unable to convert a past Epoch date into a format such as YYYY/MM/DD or MM/DD/YYYY. I am using bash and don't know... (4 Replies)
Discussion started by: newbie2010
4 Replies

10. Shell Programming and Scripting

Date Format MM/DD/YYYY

I am changing epoch times to dates. I was able to do the following: echo "$varx" | gawk '{print strftime("%c", $0)}' Mon Dec 31 16:26:40 2012 This changes the epoch date (which is what varx is) into localtime. However, my problem is that I only want 12/31/2012 and not the Mon Dec 31... (2 Replies)
Discussion started by: newbie2010
2 Replies
nfreplay(1)															       nfreplay(1)

NAME
nfreplay - netflow replay program SYNOPSIS
nfreplay [options] [filter] DESCRIPTION
nfreplay is the netflow replay program of the nfdump tool set. It reads data from files stored by nfcapd and sents the netflow data to a host or a multicat group. The filter syntax is equivalent to nfdump. If a filter is supplied, only the matching flows are sent. See the nfdump(1) man page for a detailed description of the filter syntax. All records are sent as netflow version 5. OPTIONS
-H remotehost Send all flows to this remote host. Accepts a symbolic name or a IPv4/IPv6 IP address. Defaults to IPv4 localhost 127.0.0.1. -j mcastgroup Join this multicast group and send all flows to this group host. Accepts a symbolic name or multicast IPv4/IPv6 IP address. -p port Send all flows to this port on the remote side. Default is 9995. -4 Forces nfreplay to send flows to a IPv4 address only. Can be used together with -i if the remote host has an IPv4 and IPv6 address record. -6 Forces nfreplay to send flows to a IPv6 address only. Can be used together with -i if the remote host has an IPv4 and IPv6 address record. -v num Send flows as netflow version num. 5 and 9 are supported. The default is sending the flows as netflow version 5. In version 5 mode, IPv6 flows, are skipped and 64bit counters are truncated to 32bit. -d usec Delay each record by usec mirco seconds, to avoid overrun on the remote side. Default is 10. -b buffersize Set send buffer size in bytes. Useful for large data to transfer. Default is system dependent. -r inputfile Read input data from inputfile. Default is read from stdin. -t timewin Send only flows, which fall in the time window timewin, where timewin is YYYY/MM/dd.hh:mm:ss[-YYYY/MM/dd.hh:mm:ss]. Any parts of the time spec may be omitted e.g YYYY/MM/dd expands to YYYY/MM/dd.00:00:00-YYYY/MM/dd.23:59:59 and sends all flow from a given day. -c num Limit number of records to send to the first num flows. -V Print nfreplay version and exit. -h Print help text on stdout with all options and exit. RETURN VALUE
Returns 0 No error. 255 Initialization failed. 254 Error in filter syntax. 250 Internal error. NOTES
SEE ALSO
nfcapd(1), nfdump(1), nfprofile(1) BUGS
2009-09-09 nfreplay(1)
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy