Sponsored Content
Operating Systems AIX convert date in lilian format for shell (AIX) Post 57849 by Perderabo on Monday 8th of November 2004 04:16:34 PM
Old 11-08-2004
According to a web site I found:

148138 = 1988-5-16
148139 = 5/17/1988

these are two examples of lilian dates from an IBM website.

Using ksh,

function lil { datecalc -j $(( $1 - 100841)) ; }

defines a function and then "lil 148138" results in "1988 5 16". This function depends on my datecalc script.

And you know where to get datecalc, since it is mentioned in the "Yesterdays Date/Date Arithmetic" article in our FAQ section which you certainly read before you posted your question. Smilie

This was an interesting question. I had never heard of lilian date format before. It looks like IBM went to a lot of trouble to re-invent the wheel. As far as I can see, the only difference between lilian date format and the standard mjd is, well, 100,841 days.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convert mmddyy date format to ccyyddd format??

hi, for reading a cobol indexed file i need to convert "mmddyy" date format to "ccyyddd" format. i checked the datecalc and other scripts but couldnt modify them to cater to my need:(... The datecalc gives an output which i believe is the total days till that date, but i want to convert it... (2 Replies)
Discussion started by: Bhups
2 Replies

2. UNIX for Dummies Questions & Answers

Convert date format

Hi All, Need your help in converting a date format in ksh. I'm currently working on SUN os where my script is getting a date from a table. The result returns to ksh in this format: 17-JUL-08 How do i convert this string to a date format like yyyymmdd? I tried #!/bin/ksh d="17-JUL-08"... (5 Replies)
Discussion started by: agathaeleanor
5 Replies

3. Shell Programming and Scripting

convert date format to mysql date format in log file

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

4. Shell Programming and Scripting

Convert date to Unix format

Dear Expert How to convert date in format of YYYY-MM-DD HH:MM:SS to unix format using a script or command if avaliable Example "2011-05-15 18:00:00" is converted to 1330970400 I tried to use option d in date command but no use, Im using solaris 10 Thanks a lot (12 Replies)
Discussion started by: yahyaaa
12 Replies

5. Shell Programming and Scripting

convert date format

I've been using this thread: https://www.unix.com/shell-programming-scripting/58675-change-date-dd-mmm-yyyy-mm-dd-yyyy.html and https://www.unix.com/shell-programming-scripting/14655-changing-yyyy-mm-dd-ddmmyy.html and this code: on this format: 05/16/2008 18:30:49 Installation 48985and I'm... (3 Replies)
Discussion started by: dba_frog
3 Replies

6. Shell Programming and Scripting

Convert any date format into yyyy/mm/dd

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)
Discussion started by: ZeroHedge
1 Replies

7. Shell Programming and Scripting

awk convert date format

Could you tell me how to convert the following dates? If I have m/d/yyyy, I want to have 0m/0d/yyyy. I want my dates to always be 8 digits. In other words, I want a 0 inserted whenever the month or day is a single digit. My issue is first I need to use FS="," to get field $4 for the... (7 Replies)
Discussion started by: wbrunc
7 Replies

8. Shell Programming and Scripting

Convert string into date format

Hi, I am getting the below string as a input for date. 12/03/2013 11:02 AM I want to change this date as 03-DEC-2013 11:02 AM. Could you please help on this. Thanks Chelladurai (4 Replies)
Discussion started by: ckchelladurai
4 Replies

9. Shell Programming and Scripting

Convert Date Format

Hello, I want to change the format of date value in variable. e.g. cur_date = '2013/03/13 14:24:50' (yyyy/mm/dd hh24:mi:ss) I want to change this to '13-MAR-2013 14:24:50 Following code coverts the current date to format I am looking for. But I do not know how this can be done for a date... (8 Replies)
Discussion started by: cartrider
8 Replies

10. Shell Programming and Scripting

Convert date format

Hi guys I am looking to convert this kind of entry in a txt file 26/04/2008 to April 2008 Note : this is not using the date command , these are date entries in a file can i do this with sed ? Use code tags, thanks. (5 Replies)
Discussion started by: johnnybananas
5 Replies
Test::MockTime::DateCalc(3pm)				User Contributed Perl Documentation			     Test::MockTime::DateCalc(3pm)

NAME
Test::MockTime::DateCalc -- fake time for Date::Calc functions SYNOPSIS
use Test::MockTime; use Test::MockTime::DateCalc; # before Date::Calc loads # ... use My::Module::Using::Date::Calc; DESCRIPTION
"Test::MockTime::DateCalc" arranges for the functions in "Date::Calc" to follow the Perl level "time" function (see perlfunc), and in particular any fake date/time set there by "Test::MockTime". The following "Date::Calc" functions are changed System_Clock Today Now Today_and_Now This_Year Gmtime Localtime Timezone Time_to_Date "Gmtime", "Localtime", "Timezone" and "Time_to_Date" are made to default to the Perl-level current "time". When called with an explicit time argument they're unchanged. Module Load Order "Test::MockTime" or similar fakery must be loaded first, before anything with a "time()" call, which includes "Test::MockTime::DateCalc". This is the same as all "CORE::GLOBAL" overrides, see "OVERRIDING CORE FUNCTIONS" in CORE. "Test::MockTime::DateCalc" must be loaded before "Date::Calc". If "Date::Calc" is already loaded then its functions might have been imported into other modules and such imports are not affected by the redefinitions made. For that reason "Test::MockTime::DateCalc" demands it be the one to load "Date::Calc" for the first time. Usually this simply means having "Test::MockTime::DateCalc" at the start of a test script, before the things you're going to test. use strict; use warnings; use Test::MockTime ':all'; use Test::MockTime::DateCalc; use My::Foo::Bar; set_fixed_time('1981-01-01T00:00:00Z'); is (My::Foo::Bar::something(), 1981); restore_time(); In a test script it's often good to have your own modules early to check they correctly load their pre-requisites. You might want a separate test script for that so you don't accidentally rely on "Test::MockTime::DateCalc" loading "Date::Calc" for you. Other Faking Modules "Test::MockTime::DateCalc" can be used with other modules which mangle the Perl-level "time" too. For example "Time::Fake", use Time::Fake; # fakery first use Test::MockTime::DateCalc; Or "Time::Mock", use Time::Mock; # fakery first use Test::MockTime::DateCalc; "Time::Warp" (as of version 0.5) only exports a new "time", it's not a core override and so can't be used with "Test::MockTime::DateCalc". SEE ALSO
Date::Calc, Test::MockTime, Time::Fake, Time::Mock faketime(1) HOME PAGE
http://user42.tuxfamily.org/test-mocktime-datecalc/index.html COPYRIGHT
Copyright 2009, 2010 Kevin Ryde Test-MockTime-DateCalc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Test-MockTime-DateCalc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Test-MockTime-DateCalc. If not, see <http://www.gnu.org/licenses/>. perl v5.10.1 2010-09-15 Test::MockTime::DateCalc(3pm)
All times are GMT -4. The time now is 03:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy