9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
i try to change the date-format from DD/MM/YYYY into MM/DD/YY.
Input-Data:
...
31/12/2013,23:40,198.00,6.20,2,2,2,1,11580.0,222
31/12/2013,23:50,209.00,7.30,2,2,3,0,4380.0
01/01/2014,00:00,205.90,8.30,2,2,3,1,9360.0,223
...
Output-Data should be:
...... (7 Replies)
Discussion started by: IMPe
7 Replies
2. UNIX for Dummies Questions & Answers
Hi Unix Gurus,
I would like to rename several files in a Unix Directory . The filenames can have more than 1 underscore ( _ ) and the last underscore is always followed by a date in the format mmddyyyy. The Extension of the files can be .txt or .pdf or .xls etc and is case insensitive ie... (1 Reply)
Discussion started by: pchegoor
1 Replies
3. Shell Programming and Scripting
Dear all,
I have 2 questions.
I have a file with many rows which has date of the format YYYYMMDD.
1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too.
2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 Replies
4. Shell Programming and Scripting
Hi All,
I am new to this forum. Could anyone help me to resolve the following issue.
Input of the flat file contains several lines of text for example find below:
5022090,2,4,7154,88,,,,,4/1/2011 0:00,Z,L,2
5022090,3,1,6648,88,,,,,4/1/2011 0:00,Z,,1
5022090,4,1,6648,88,,,,,4/1/2011... (6 Replies)
Discussion started by: av_sagar
6 Replies
5. UNIX for Advanced & Expert Users
Hi All,
I am new to this forum, could any one help me out in resolving the below issue.
Input of the flat file contains several lines of text for example find below:
5022090,2,4,7154,88,,,,,4/1/2011 0:00,Z,L,2
5022090,3,1,6648,88,,,,,4/1/2011 0:00,Z,,1... (0 Replies)
Discussion started by: av_sagar
0 Replies
6. Shell Programming and Scripting
Dear Friends,
We have date in output as MM/DD/YYYY format and I want to convert it in DD/MM/YYYY format.
e.g.
12/31/2010 to 31/12/2010
We have checked forum for the solution but we are not getting matching query.
Please guide us
Thanks
Anushree. (6 Replies)
Discussion started by: anushree.a
6 Replies
7. Shell Programming and Scripting
Hi,
I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix.
My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies
8. Shell Programming and Scripting
I have a comma delimited log file which has the date as MM/DD/YY in the 2nd column, and HH:MM:SS in the 3rd column.
I need to change the date format to YYYY-MM-DD and merge it with the the time HH:MM:SS. How will I got about this?
Sample input
02/27/09,23:52:31
02/27/09,23:52:52... (3 Replies)
Discussion started by: hazno
3 Replies
9. UNIX for Dummies Questions & Answers
I need to capture a file's creation/modification date and time and convert this to a different format, whilst I can easily get the existing format from a ls -l | awk ' { print $......}' or a cut command I do not know how to convert it to a desired format?
I should add that at present the ls -l... (1 Reply)
Discussion started by: barney_clough
1 Replies
Template::Plugin::Date(3) User Contributed Perl Documentation Template::Plugin::Date(3)
NAME
Template::Plugin::Date - Plugin to generate formatted date strings
SYNOPSIS
[% USE date %]
# use current time and default format
[% date.format %]
# specify time as seconds since epoch
# or as a 'h:m:s d-m-y' or 'y-m-d h:m:s' string
[% date.format(960973980) %]
[% date.format('4:20:36 21/12/2000') %]
[% date.format('2000/12/21 4:20:36') %]
# specify format
[% date.format(mytime, '%H:%M:%S') %]
# specify locale
[% date.format(date.now, '%a %d %b %y', 'en_GB') %]
# named parameters
[% date.format(mytime, format = '%H:%M:%S') %]
[% date.format(locale = 'en_GB') %]
[% date.format(time = date.now,
format = '%H:%M:%S',
locale = 'en_GB) %]
# specify default format to plugin
[% USE date(format = '%H:%M:%S', locale = 'de_DE') %]
[% date.format %]
...
DESCRIPTION
The "Date" plugin provides an easy way to generate formatted time and date strings by delegating to the "POSIX" "strftime()" routine.
The plugin can be loaded via the familiar USE directive.
[% USE date %]
This creates a plugin object with the default name of '"date"'. An alternate name can be specified as such:
[% USE myname = date %]
The plugin provides the "format()" method which accepts a time value, a format string and a locale name. All of these parameters are
optional with the current system time, default format ('"%H:%M:%S %d-%b-%Y"') and current locale being used respectively, if undefined.
Default values for the time, format and/or locale may be specified as named parameters in the "USE" directive.
[% USE date(format = '%a %d-%b-%Y', locale = 'fr_FR') %]
When called without any parameters, the "format()" method returns a string representing the current system time, formatted by "strftime()"
according to the default format and for the default locale (which may not be the current one, if locale is set in the "USE" directive).
[% date.format %]
The plugin allows a time/date to be specified as seconds since the epoch, as is returned by "time()".
File last modified: [% date.format(filemod_time) %]
The time/date can also be specified as a string of the form "h:m:s d/m/y" or "y/m/d h:m:s". Any of the characters : / - or space may be
used to delimit fields.
[% USE day = date(format => '%A', locale => 'en_GB') %]
[% day.format('4:20:00 9-13-2000') %]
Output:
Tuesday
A format string can also be passed to the "format()" method, and a locale specification may follow that.
[% date.format(filemod, '%d-%b-%Y') %]
[% date.format(filemod, '%d-%b-%Y', 'en_GB') %]
A fourth parameter allows you to force output in GMT, in the case of seconds-since-the-epoch input:
[% date.format(filemod, '%d-%b-%Y', 'en_GB', 1) %]
Note that in this case, if the local time is not GMT, then also specifying '%Z' (time zone) in the format parameter will lead to an
extremely misleading result.
Any or all of these parameters may be named. Positional parameters should always be in the order "($time, $format, $locale)".
[% date.format(format => '%H:%M:%S') %]
[% date.format(time => filemod, format => '%H:%M:%S') %]
[% date.format(mytime, format => '%H:%M:%S') %]
[% date.format(mytime, format => '%H:%M:%S', locale => 'fr_FR') %]
[% date.format(mytime, format => '%H:%M:%S', gmt => 1) %]
...etc...
The "now()" method returns the current system time in seconds since the epoch.
[% date.format(date.now, '%A') %]
The "calc()" method can be used to create an interface to the "Date::Calc" module (if installed on your system).
[% calc = date.calc %]
[% calc.Monday_of_Week(22, 2001).join('/') %]
The "manip()" method can be used to create an interface to the "Date::Manip" module (if installed on your system).
[% manip = date.manip %]
[% manip.UnixDate("Noon Yesterday","%Y %b %d %H:%M") %]
AUTHORS
Thierry-Michel Barral wrote the original plugin.
Andy Wardley provided some minor fixups/enhancements, a test script and documentation.
Mark D. Mills cloned "Date::Manip" from the "Date::Calc" sub-plugin.
COPYRIGHT
Copyright (C) 2000-2007 Thierry-Michel Barral, Andy Wardley.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template::Plugin, POSIX
perl v5.12.1 2009-06-30 Template::Plugin::Date(3)