Jump to content
Macro Express Forums

Set Date/Time variable from file


Recommended Posts

I want a date variable set from one of the dates of a file. Like Variable Set From File - Get File Date/Time and Ive decided it doesn't exist. EG count all the files in a folder that have aged over 5 work days.

 

This was something I complained about during the beta that the time variable type was great but it wasn't well implemented and their are all kinds of holes in it. This is a prime example. But I think many could be worked around if I could take a date and time string of text and convert it to decimal Delphi time. Personally I think it should be a function in MEP but ISS didn't agree to I've resolved to write a macro to do just this. Time is easy and I already have a routine that counts days of a year based on month and day that even work with all the leap day rules so now I just need a year calculator. I came up with a basic algorithm that would work from 1900 on but now I've decided I want it to work for all times sake so I'm making some slight adjustments to the logic to work with the 4, 100, and 400 leap day rules in both positive and negative from 1900. So now we all will be able to take dates in all kinds of ways and shoehorn them into MEP time vars. I think I'll also formalize my day of the week routine and weekday test. Eventually I might even do holidays. I wish this was all in MEP but now that it's apparent it will not be I'll pick up the flag. It just bums me out a little because I bet there are some functions in Delphi that would be a lot more simple. Too bad I couldn't make a few bucks off these functions.

Link to comment
Share on other sites

I want a date variable set from one of the dates of a file. Like Variable Set From File - Get File Date/Time and Ive decided it doesn't exist.

Cory I'm confused. Isn't getting the date and time from a file exactly what the Variable Set From File does? What point am I missing?

Link to comment
Share on other sites

Correct, it does. But it saves it to a collection of string varables, not TIME variables.

So you're saying you need the datetime stamp of a file to be presented to you as a MX Pro decimal value so you can use the Convert Decimal to Date/Time command? Which stamp: created, modified, or accessed?

Link to comment
Share on other sites

Yes. More technically I wish MEP would have a drop-down option to directly save the date stamp to a time variable. And at the moment I want the creation time but in other instance I will certainly need the others.

 

But the thing is we need this for many different places. What we need is a Variable Modify String > Convert to Decimal Time. Let's say you grab data off a web page harvest or something that has a string date. Well if we want that to work with the time variables we're hosed at the moment. So I've started writing a macro that will parse a variety of standard date and time formats into year, month, day, hour, minute, second and calculate the decimal time. My fisrt algorithm was fatally flawed for extreme dates but I think I know a solution now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...