Sponsored Content
Full Discussion: Problem with date in perl!!
Top Forums Shell Programming and Scripting Problem with date in perl!! Post 302467014 by abhisharma23 on Thursday 28th of October 2010 03:23:55 AM
Old 10-28-2010
Let me clarify the issue that I am facing..

There is a table
create table MyTable
(
S_No int,
date datetime
)

The data in it is as :

select * from MyTable

1 14/03/2010 00:00:00.000
2 12/04/2010 00:00:00.000

Date is in DD/MM/YYYY format in the table.

But now when I am fetching the same data through perl and writing it in a file with pipe separated values, it is coming up as:

more file.txt:

S_No|date
1|Mar 14 2010 12:00AM
2|Apr 12 2010 12:00AM

The format of date is coming up as different in a file from what we have in table. I want it to be same as that of table.
While investigating, I also got to know that not only in perl, if we do simple isql for sybase and redirect the output to the file, date gets converted to 'Mar 14 2010 12:00AM' irespective of the format it is in the table.
What I am not getting is how unix/shell/perl script is converting the date themselves? and how do I keep it the way it is in table?

Thanks
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date problem in perl

Hi, My script is here-- #!/usr/bin/perl no warnings "uninitialized"; use File::Copy; use File::stat; use Time::Local; use IO::Handle; use DateTime; use Getopt::Long; use File::Glob ':glob'; my $Summary; my $Individual; my $Diagnostics; my $All; (3 Replies)
Discussion started by: namishtiwari
3 Replies

2. Programming

Date time problem while executing perl script.

Hi All, This Monday 15th March 2010, i have faced a weired issue with my Perl script execution, this script is scheduled to run at 1 minute past midnight on daily basis ( 00:01 EST ) generally for fetching previous business date , say if it is Monday it should give last Friday date, for Tuesday... (0 Replies)
Discussion started by: ravimishra
0 Replies

3. Shell Programming and Scripting

problem with date in perl

hi guys, i have a variable date that stores the current date....now i need to subtract 2 minutes from it...can someone tell me how to do it in perl.... (5 Replies)
Discussion started by: niteesh_!7
5 Replies

4. Programming

Problem with perl pattern for date

Hello Friends, I have been struck with a perl script for quite some time now. I have a log file which gives a date which is sometimes coming in this format Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 15:12:50 or sometimes in this format Script... (2 Replies)
Discussion started by: achak01
2 Replies

5. Shell Programming and Scripting

Need to capture dates between start date and end date Using perl.

Hi All, Want to get all dates and Julian week number for that date between the start date and end date. How can I achive this using perl? (To achive above functionality, I was connecting to the database from DB server. Need to execute the same script in application server, since databse... (6 Replies)
Discussion started by: Nagaraja Akkiva
6 Replies

6. Shell Programming and Scripting

Extract week start,end date from given date in PERL

Hi All, what i want to do in perl is i should give the date at run time .Suppose date given is 23/12/2011(mm/dd/yyyy) the perl script shold find week start date, week end date, previous week start date,end date,next week start date, end date. In this case week start date will be-:12/19/2011... (2 Replies)
Discussion started by: parthmittal2007
2 Replies

7. Shell Programming and Scripting

Fetch date of 7 years back from current date in Perl

$beginDate = substr(DateCalc("today", "-7Days"),0,8); This fetches the date 7 days back Can I fetch the date before 7 years from todays date in Perl using same syntax Use code tags, see PM. (3 Replies)
Discussion started by: parthmittal2007
3 Replies

8. Shell Programming and Scripting

Problem in passing date to external function from perl script.

my $sysdate = strftime('%Y-%m-%d', localtime ); biDeriveByDate('Table_Str',$sysdate,\@lIndx,\@lResVals) In a perl script, when I'm trying to pass $sysdate to some external function it's not working since $sysdate is passed as a string mentioned above but my function is expecting a date value... (1 Reply)
Discussion started by: Devesh5683
1 Replies
REPARTITION(8)						      System Manager's Manual						    REPARTITION(8)

NAME
repartition - load a partition table SYNOPSIS
repartition device [partition-file] DESCRIPTION
Repartition uploads a new partition table for the partitions of device. The table is obtained from the first sector of partition-file if given, device otherwise. Device may refer to the whole drive or a primary partition, depending on whether you want to upload a partition or a subpartition table. The partitions will be truncated to fit within the enclosing device like the disk driver does, unless the numbers are coming from partition-file. EXAMPLES
repartition /dev/hd0 repartition /dev/hd4 /etc/hd4.table Reload the partition table of drive 0 setting /dev/hd[1-4], and the subpartition table of /dev/hd4 setting /dev/hd4[a-d] using a file. The latter may be useful if you need more than the 4 subpartitions a single Minix partition gives you. DIAGNOSTICS
The new table is printed on standard output. FILES
/dev/hd[0-9] SEE ALSO
hd(4), part(8). BUGS
The disk must be in use for the changes to stick. The partition table of an idle disk will be reloaded on the first open. AUTHOR
Kees J. Bot (kjb@cs.vu.nl) REPARTITION(8)
All times are GMT -4. The time now is 10:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy