Sponsored Content
Special Forums UNIX and Linux Applications Calculating age from date of birth Post 302461947 by jgt on Tuesday 12th of October 2010 08:14:08 PM
Old 10-12-2010
20101012 - 19500101 = 600911
int(600911/10000) = 60
20101012 - 19501011=60001
int(60001/10000)=60
20101012 - 19501013=599999
int(59999/10000)=59

Un-formatted dates are probably in the seconds since an epoch date. Depending on the source, this could be Jan 1 1970 ending in 2037 for 32 bit values.
 

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

What is your age?

What is your age? (15 Replies)
Discussion started by: royal
15 Replies

2. Shell Programming and Scripting

file age

How can I count the age of the file (e.g. in minutes)? (4 Replies)
Discussion started by: jarmo.leppanen
4 Replies

3. Shell Programming and Scripting

Store date-of-birth as "1#7#0#2#" in file

Hello, My input files are having header/body/footer. The first three digits finds whether the data is header/body/footer. For example, 010AAAAA 20100507 234KB BBBBBBBBBB_20100506.DAT 020CCCCC DDDDDDDDD 373983983 19750426 456.90 ... (1 Reply)
Discussion started by: nvkuriseti
1 Replies

4. Shell Programming and Scripting

Calculating using date

I need to help to calculating using date in a script. One application is licensed by date, some month at a time. I can read the date from system and get an output like this: echo $status 6A34 System4 01.01.11-31.01.11 My goal is to use license date 31.01.11 and subtract todays date... (7 Replies)
Discussion started by: Jotne
7 Replies

5. UNIX and Linux Applications

sqlite: calculating with dates - compare current date minus 6 months with stored record

Hi I have a table with name, date in format DD.MM.YYYY. I need to something like this (I try to explain in pseudo code) if SYSDATE (current date) minus 6 months > $expiry date print OK else print NOK with $name and $expiry date I know this is possible with Oracle. How to do this... (0 Replies)
Discussion started by: slashdotweenie
0 Replies

6. Shell Programming and Scripting

Calculating 7 days ago date for the given Argument

Hi I have shell script and I am facing the below issue to integrate the date calculation to the the script. If I give the $1 as the date(20110701) then I need to get the 7 days ago date for the same format.(20110624). At first I thought its a simple one to handle and I did a search in the... (10 Replies)
Discussion started by: filter
10 Replies

7. Shell Programming and Scripting

Calculating expiry date using date,sed,grep

Hi, I would greatly appreciate it if someone can help me with my problem. I have a crawler which collects spam URLs everyday & this data needs to be published in a blacklist. Here's the catch: The "Time To Live" (TTL) for each URL is 3 months (or whatever for that matter). If i see the... (5 Replies)
Discussion started by: r4v3n
5 Replies

8. Shell Programming and Scripting

Calculating the epoch time from standard time using awk and calculating the duration

Hi All, I have the following time stamp data in 2 columns Date TimeStamp(also with milliseconds) 05/23/2012 08:30:11.250 05/23/2012 08:30:15.500 05/23/2012 08:31.15.500 . . etc From this data I need the following output. 0.00( row1-row1 in seconds) 04.25( row2-row1 in... (5 Replies)
Discussion started by: ks_reddy
5 Replies

9. UNIX for Dummies Questions & Answers

Age of file

Hi All.. Is there any easy way to find out how many days older is file? for ex. fileA 20 days fileB 10 days I am currently on AIX, and there is no STAT command available in this environment. What are my options? Thanks Abhijeet R (1 Reply)
Discussion started by: freakabhi
1 Replies
Time::Piece::MySQL(3pm) 				User Contributed Perl Documentation				   Time::Piece::MySQL(3pm)

NAME
Time::Piece::MySQL - Adds MySQL-specific methods to Time::Piece SYNOPSIS
use Time::Piece::MySQL; my $time = localtime; print $time->mysql_datetime; print $time->mysql_date; print $time->mysql_time; my $time = Time::Piece->from_mysql_datetime( $mysql_datetime ); my $time = Time::Piece->from_mysql_date( $mysql_date ); my $time = Time::Piece->from_mysql_timestamp( $mysql_timestamp ); DESCRIPTION
Using this module instead of, or in addition to, "Time::Piece" adds a few MySQL-specific date-time methods to "Time::Piece" objects. OBJECT METHODS
mysql_date / mysql_time / mysql_datetime / mysql_timestamp Returns the date and/or time in a format suitable for use by MySQL. CONSTRUCTORS
from_mysql_date / from_mysql_datetime / from_mysql_timestamp Given a date, datetime, or timestamp value as returned from MySQL, these constructors return a new Time::Piece object. If the value is NULL, they will retrun undef. CAVEAT "Time::Piece" itself only works with times in the Unix epoch, this module has the same limitation. However, MySQL itself handles date and datetime columns from '1000-01-01' to '9999-12-31'. Feeding in times outside of the Unix epoch to any of the constructors has unpredictable results. Also, MySQL doesn't validate dates (because your application should); it only checks that dates are in the right format. So, your database might include dates like 2004-00-00 or 2001-02-31. Passing invalid dates to any of the constructors is a bad idea: on my system the former type (with zeros) returns undef (previous version used to die) while the latter returns a date in the following month. AUTHOR
Original author: Dave Rolsky <autarch@urth.org> Current maintainer: Marty Pauley <marty+perl@kasei.com> COPYRIGHT
(c) 2002 Dave Rolsky (c) 2004 Marty Pauley This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Time::Piece perl v5.12.4 2008-06-07 Time::Piece::MySQL(3pm)
All times are GMT -4. The time now is 12:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy