Hi
I am having date as a string in DDMMYYYY format(07082008) in a variable say cdate. I want to Convert it into DD Month YYYY format(7 August 2008). Could someone help. Thanks in Advance. (2 Replies)
I have a file which has 100k+ records like this
abc,05-JUN-1974,def,lkj,aaa
def,11-SEP-1975,ghj,dis,dea
I want to convert ex 05-JUN-1974 to 06/05/1974
Please help me with awk script to convert the whole file into MM-DD-YYYY
Thank you! (2 Replies)
In my shell script i have a variable which stores date in the format of YYYYMMDD. Is there any way to format this value to MM/DD/YYYY.
Thanks. (8 Replies)
Hi all
I have some pipe-separated data in the form:
5/12/2008 00:00:00|31/1/2009 00:00:00|SOMESTUFF|OTHERSTUFF
12/31/2008 00:00:00|15/1/2009 00:00:00|MORESTUFF|REMAININGSTUFF
1/1/1023 00:00:00|16/5/2047 00:00:00|THEREST|YETMORE
I need to zero-pad the single-digit days and months, using... (3 Replies)
My csv has data like this
x,x,3452,2/18/1986,abc
x,g,19711,1/24/1986,abc
i want to replace date in the following format YYYY-mm-dd
how do i convert using awk script ? (8 Replies)
How can I convert any user inputted date into yyyy/mm/dd ?
For example user can input date one of the following 20120121 , 2012-01-21 ,01/21/2012,01/21/2012 etc
But I need to convert any of the date entered by user into yyyy/mm/dd (2012/01/2012). Any suggestion. Thanks in advance
this is... (1 Reply)
Hi All,
I have file like
“April 10, 2013”,”raj”
“April 29, 2013”,”raj1”
Output :
“2013/04/10”,”raj”
“2013/04/29”,”raj1”
Please help me how to do... (9 Replies)
I am using bash that when run downloads a file a verifies that there is data in it. What I am not able to do is have a user enter a date in any format they wish and have it converted to m-d-yyyy. Thank you :).
Bash
printf " Welcome to NGS analysis, checking for new files and creating a... (2 Replies)
How to convert mmm-yy to mm/dd/yyyy format in unix ?
example:
Jan-99 to 01/01/1999
Jan-00 to 01/01/2000
Jan-25 to 01/01/2025
Dec-99 to 01/12/1999
Dec-00 to 01/12/2000
Dec-25 to 01/12/2025
YY anything between 00-50 should be 2000-2050
YY anything between 51-99 should be 1951-1999
... (2 Replies)
Discussion started by: gksenthilkumar
2 Replies
LEARN ABOUT DEBIAN
datetime::format::epoch
DateTime::Format::Epoch(3pm) User Contributed Perl Documentation DateTime::Format::Epoch(3pm)NAME
DateTime::Format::Epoch - Convert DateTimes to/from epoch seconds
SYNOPSIS
use DateTime::Format::Epoch;
my $dt = DateTime->new( year => 1970, month => 1, day => 1 );
my $formatter = DateTime::Format::Epoch->new(
epoch => $dt,
unit => 'seconds',
type => 'int', # or 'float', 'bigint'
skip_leap_secondss => 1,
start_at => 0,
local_epoch => undef,
);
my $dt2 = $formatter->parse_datetime( 1051488000 );
# 2003-04-28T00:00:00
$formatter->format_datetime($dt2);
# 1051488000
DESCRIPTION
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the number of seconds since a given
epoch. It can also do the reverse.
METHODS
o new( ... )
Constructor of the formatter/parser object. It can take the following parameters: "epoch", "unit", "type", "skip_leap_seconds",
"start_at", "local_epoch" and "dhms".
The epoch parameter is the only required parameter. It should be a DateTime object (or at least, it has to be convertible to a DateTime
object). This datetime is the starting point of the day count, and is usually numbered 0. If you want to start at a different value,
you can use the start_at parameter.
The unit parameter can be "seconds", "milliseconds, "microseconds" or "nanoseconds". The default is "seconds". If you need any other
unit, you must specify the number of units per second. If you specify a number of units per second below 1, the unit will be longer
than a second. In this way, you can count days: unit => 1/86_400.
The type parameter specifies the type of the return value. It can be "int" (returns integer value), "float" (returns floating point
value), or "bigint" (returns Math::BigInt value). The default is either "int" (if the unit is "seconds"), or "bigint" (if the unit is
nanoseconds).
The default behaviour of this module is to skip leap seconds. This is what (most versions of?) UNIX do. If you want to include leap
seconds, set skip_leap_seconds to false.
Some operating systems use an epoch defined in the local timezone of the computer. If you want to use such an epoch in this module, you
have two options. The first is to submit a DateTime object with the appropriate timezone. The second option is to set the local_epoch
parameter to a true value. In this case, you should submit an epoch with a floating timezone. The exact epoch used in "format_datetime"
will then depend on the timezone of the object you pass to "format_datetime".
Most often, the time since an epoch is given in seconds. In some circumstances however it is expressed as a number of days, hours,
minutes and seconds. This is done by NASA, for the so called Mission Elapsed Time. For example, 2/03:45:18 MET means it has been 2
days, 3 hours, 45 minutes, and 18 seconds since liftoff. If you set the dhms parameter to true, format_datetime returns a four element
list, containing the number of days, hours, minutes and seconds, and parse_datetime accepts the same four element list.
o format_datetime($datetime)
Given a DateTime object, this method returns the number of seconds since the epoch.
o parse_datetime($secs)
Given a number of seconds, this method returns the corresponding DateTime object.
BUGS
I think there's a problem when you define a count that does not skip leap seconds, and uses the local timezone. Don't do that.
SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
AUTHOR
Eugene van der Pijll <pijll@gmx.net>
COPYRIGHT
Copyright (c) 2003-2006 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
SEE ALSO
DateTime
datetime@perl.org mailing list
perl v5.10.1 2007-12-03 DateTime::Format::Epoch(3pm)