Datetime Format 'yyyymmddmiss' Calculation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Datetime Format 'yyyymmddmiss' Calculation
# 1  
Old 07-27-2010
Datetime Format 'yyyymmddmiss' Calculation

Given a time format yyyymmddmiss

201007221403

How can I add or minus minutes such that it becomes

201007221348

when I minus away 15 minutes from the time?

Also, given a time frame, let say 10 days, how do I check if a date 201006231403 that is not more than 10 days behind 201007221403 ?

Thank you very much for any hep given.
# 2  
Old 07-27-2010
# 3  
Old 07-27-2010
convert to epoc time first, minus 15 minutes that is 900 seconds.

then convert back to date/time format.
# 4  
Old 07-28-2010
What Operating System and version do you have? What shell are you running?
Some versions of Linux come with and extended "date" command which can be useful for date arithmetic. Similarly some come with an extended "find" command with the "-mmin" parameter which can be useful for this sort of problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filename with datetime

Hello All, I need unix command to generate a file with datetime in it. For example : ABC_YYYYMMDDHH24MISS.txt Regards Biswajeet Ghosh (1 Reply)
Discussion started by: bghosh
1 Replies

2. AIX

AIX DateTime Computation

Good day people, Kindly advice on below please. 1) Formatting/ Arithmetic operation of given date I understand from the AIX man date and some research that flag -d is not applicable for AIX shell scripting and some of the UNIX command date command is not available in AIX. Please advice... (1 Reply)
Discussion started by: cielle
1 Replies

3. Shell Programming and Scripting

How to compare datetime?

Hi, To get the batch status, I will need to check if the particular job started after 5PM. if the job start time is before 5 pm, then it means that the job has not started for this particular date. I will run the script with date as argument. For eg: BS 07/10/2012 Start time from the log is... (8 Replies)
Discussion started by: ajayakunuri
8 Replies

4. Shell Programming and Scripting

XML dateTime format in shell script

How can i frame current date & time in the xml standard dateTime format in shell script 2011-10-18T12:00:00.000000 I got up to the date format using the below code date '+%Y'-'%m'-'%d'T ---------- Post updated at 09:10 AM ---------- Previous update was at 08:53 AM ---------- ... (6 Replies)
Discussion started by: vel4ever
6 Replies

5. Shell Programming and Scripting

How to generate datetime string?

Hi. I'm hoping there is a simple method where I'm able to generate a datetime string that looks like this (yyyymmddhhmm): 201106280830 The tricky part would be that I need this string to be today's datetime minus 1 year. Is there anyway to do this? (3 Replies)
Discussion started by: buechler66
3 Replies

6. Shell Programming and Scripting

datetime difference in seconds

Hi, I'm trying to find processing time of my script. Please can someone give me the commands to get the start/end time in "dd-mm-yyyy hh:mm:ss" and the differnce in seconds. Thanks! (5 Replies)
Discussion started by: dvah
5 Replies

7. Programming

SQL datetime calculation

Suppose I have a mysql table consisting of measurements taken during irregular intervals as follows: CREATE TABLE data (datetime DATETIME, value INTEGER); mysql> SELECT datetime, value FROM data; +---------------------+---------+ | datetime | value |... (2 Replies)
Discussion started by: figaro
2 Replies

8. Shell Programming and Scripting

Awk new datetime everyline

Hi, I'm using awk in HP-UX machine which does not support systime(), strftime(). So to get the date time I was using : seq 1 100000 | awk ' "date +%Y%m%d%H%M%s" | getline curtime; print curtime }' However the above code gets the date only once, next time it is not updated. For... (2 Replies)
Discussion started by: Random_Net
2 Replies

9. Shell Programming and Scripting

datetime.pm

Hi, I'm trying to use datetime.pm function in Perl. I do not have in the library. Is there a way to get it and put it into library? Thanks, George. (1 Reply)
Discussion started by: gpaulose
1 Replies

10. Shell Programming and Scripting

DateTime Format Conversion in a File

Hi Pals. I have a file which is in the below format. 2007/10/15-12:04:24,'CRLift','TH-42PX75U','BestBuy','W01P0207',22,15,'User1' 2007/10/15-12:04:26,'CRLift','TH-42PX75U','BestBuy','W01P0207',22,15,'User2' 2007/10/15-12:04:29,'CRLift','TH-42PX75U','BestBuy','W01P0207',22,15,'User3'... (4 Replies)
Discussion started by: srikanthgr1
4 Replies
Login or Register to Ask a Question