forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Subtracting Dates

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DoT_PiTcH
Contributor
Contributor


Joined: 07 Aug 2002
Posts: 85

PostPosted: Thu Sep 01, 2011 8:17 pm    Post subject: Subtracting Dates Reply with quote

i have a list of files where the name schema is:

device_20110818163025.avi

so year month day hour min sec

i want to filter out any files older than 14 days from current day.

im stuck
Back to top
View user's profile Send private message Visit poster's website
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Fri Sep 02, 2011 11:34 am    Post subject: Reply with quote

Hi DoT_PiTcH:

First you must separate the different arguments:

Code:
  %1 = "device_20110818163025.avi"
  %%year = @substr(%1,8,11)
  %%month = @substr(%1,12,13)
  %%day = @substr(%1,14,15)
  %%hour = @substr(%1,16,17)
  %%minute = @substr(%1,18,19)
  %%second = @substr(%1,20,21)


Second, You must use the internal format that uses the @datetime() function to manage the time.

Actually, for your purposes, we need only the variables %%year, %%month and %%day:

Code:
%a = @datetime(,%%month/%%day/%%year)


The difference between consecutive days is 1, for example:

Code:
  %a = @datetime(,01/01/2011)
  %b = @datetime(,01/02/2011)
 
  info @diff(%b,%a)


Finally, using the current date and separating the arguments of the different files, we can get to know the days that have passed on to today:

Code:
option decimalsep,.

  %1 = "device_20110818163025.avi"
 
  %%year = @substr(%1,8,11)
  %%month = @substr(%1,12,13)
  %%day = @substr(%1,14,15)
 
  %%today = @fint(@datetime())
  %2 = @datetime(,%%month/%%day/%%year)
 
  info @diff(%%today,%2)


I hope it help you Very Happy

_______________

uVeDeSe
_______________
Back to top
View user's profile Send private message Visit poster's website
DoT_PiTcH
Contributor
Contributor


Joined: 07 Aug 2002
Posts: 85

PostPosted: Sun Sep 04, 2011 5:51 pm    Post subject: Reply with quote

Perfect thank you!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group