VB Script for date extraction and formatting - date

I work on OCR. We extract text from invoices automatically. When the contents of the invoice are extracted they are stored in a text file, and then we write scripts to extract the data from the text file according to our requirements.
One requirement that has got me stuck is, I need to extract the date from a text file which is not written in any particular format. Its written as 12 08 2014 in a line. I need to extract this and print it out in the dd/mm/yyyy format.
Also, the dates can be written in any format, for example 2nd December 2013, 12-12-2013, 12 Aug 2013 and so on. I need to read the date and extract it in the form of dd/mm/yyyy.
A little heads up for the problem.
There is no fixed location for the date. There are about 14000 invoices, most have a separate location of the date and separate format. I get the images and the scanned text file of the invoices, and i have to locate the date and try to format it.
The date is not after any fixed keyword that i could use. Like i mentioned in the first point, it can be after the word invoice number, or cost or any other work. SO the idea of searching it using keywords does not work as well.
This is the most stupid one, suppose I get the date 1/2/2011, how do I know whats the day and whats the month? The client has just entered a date, i have no way of finding out whats the day and the month. Is it even possible to find this out?
ORDERED SHIPPED
01239751 28 08 14 03 09 14 E31192-00 1
CUST.NO. ItN1 R 0 R NO SALE MM
NOM CI WATT VOTRF NO nr CAMMANOF in-W.01M
ADDRESS HERE
Te1:(123)123-1234/ Fax:(123)795-1234
Facture / Invoice
OUTPS:R-103958989 CONE:MONS Taws> NET 60 DAYS
SOLD TO / VENDU A SHIPPED TO / EXPEDIE A

You've already asked this.
You don't know and there is no way to know. We normally base it on the locale of the computer how dates are read. Yanks do m/d/y while the rest of the world do d/m/y. In the US windows functions assume the first and in the rest of the world the second.
As to years. Two digits are interpreted according to control panel settings. 29 and below is 2000 to 2029. 30 and above is 1930 - 1999.
Computers can not read the minds of people who write dates.

Related

Mailchimp Conditional Merge tags using a date field not working

This is not about the API. This is about using Mailchimp and setting conditional merge fields in the backend of Mailchimp when building a campaign. So this question is about how Mailchimp works rather than about integrating Mailchimp via an API or something similar.
(You're still here? Great! :-)
I'm trying to use a date field to show conditional content.
I have 3 people in my test mailing list, one with birthday 1/1/1960, one with 1/1/1970 and one with 1/1/1980.
I've set up an email with three conditional block so that each recipient should get the right piece of text in his mail. It looks like this.
The format I'm using is:
*|IF:BIRTHDATE>1/1/1970|*
Some text for people with a birthdate greater than 1 jan 1970
*|END:IF|*
*|IF:BIRTHDATE=1/1/1970|*
Some text for people with a birthdate equal to 1 jan 1970
*|END:IF|*
*|IF:BIRTHDATE<1/1/1970|*
Some text for people with a birthdate smaller than 1 jan 1970
*|END:IF|*
I've taken the date of the 1st of jan (1/1) to avoid possible conflicts with US and EU date notations to rule that out of the debugging process.
However, eacht recipient receives the last of the three texts when sending the test mailing, meaning that all three, regardless of their birthdate somehow match the last condition *|IF:BIRTHDATE<1/1/1970|*
This is strange since I've deliberately taken the middel birthdate to rule this out.
The date notation in the list of recipients matches the exact dat notation that I'm using in the conditions.
Does anyone have any idea how this should be done with dates in Mailchimp? I can't find any iformation on that on either Mailchimp or anywhere else on the net.
You have to use the format 'YYYY-MM-DD'.
I was struggling with this, too, but I have the below working:
*|IF:VALIDUNTIL=2016-12-31|*
Vaild Member
*|ELSE:|*
Expired Member
*|END:IF|*
Don't know if this is a recent change, but Roger's answer only works for exact date comparison.
*|IF:JOINED=2017-01-31|*
You joined ON jan 31st
*|ELSE:|*
You joined literally any other date
*|END:IF|*
If you want to use comparisons, they work the same as any other merge tag (But only in the YYYY-MM-DD format)
*|IF:JOINED>2017-01-31|*
You joined after January 31st 2017
*|ELSE:|*
You joined before January 31st 2017
*|END:IF|*

How to handle dates in neo4j

I'm an historian of medieval history and I'm trying to code networks between kings, dukes, popes etc. over a period of time of about 50 years (from 1220 to 1270) in medieval Germany. As I'm not a specialist for graph-databases I'm looking for a possibility to handle dates and date-ranges.
Are there any possibilities to handle over a date-range to an edge so that the edges, which represents a relationship, disappears after e.g. 3 years?
Are there any possibility to ask for relationships who have their date-tag in a date-range?
The common way to deal with dates in Neo4j is storing them either as a string representation or as millis since epoch (aka msec passed since Jan 01 1970).
The first approach makes the graph more easily readable the latter allows you to do math e.g. calculate deltas.
In your case I'd store two properties called validFrom and validTo on the relationships. You queries need to make sure you're looking for the correct time interval.
E.g. to find the king(s) in charge of France from Jan 01 1220 to Dec 31st 1221 you do:
MATCH (c:Country{name:'France'})-[r:HAS_KING]->(king)
WHERE r.validFrom >= -23667123600000 and r.validTo <=-23604051600000
RETURN king, r.validFrom, r.validTo
addendum
Since Neo4j 3.0 there's the APOC library which provides couple of functions for converting timestamps to/from human readable date strings.
You can also store the dates in their number representation in the following format: YYYYMMDD
In your case 12200101 would be Jan 1st 1220 and 12701231 would be Dec 31st 1270.
It's a useful and readable format and you can perform range searches like:
MATCH (h:HistoricEvent)
WHERE h.date >= 12200101 AND h.date < 12701231
RETURN h
It would also let you order by dates, if you need to.
As of Neo4J 3.4, the system handles duration and dates, see the official documentation. See more examples here.
An example related to the original question: Retrieve the historical events that happened in the last 30 days from now :
WITH duration({days: 30}) AS duration
MATCH (h:HistoricEvent)
WHERE date() - duration < date(h.date)
RETURN h
Another option for dates that keeps the number of nodes/properties you create fairly low is a linked list years (earliest year of interest - latest year), one of months (1-12), and one of dates in a month (1-31). Then every "event" in your graph can be connected to a year, month, and day. This way you don't have to create a new node for every new combination of a year month and day. You just have a single set of months, one of days, and one year. I scale the numbers to make manipulating them easier like so
Years are yyyy*10000
Months are mm*100
Date are dd
so if you run a query such as
match (event)-[:happened]->(t:time)
with event,sum(t.num) as date
return event.name,date
order by date
You will get a list of all events in chronological order with dates like Janurary 17th, 1904 appearing as 19040117 (yyyymmdd format)
Further, since these are linked lists where, for example,
...-(t0:time {num:19040000})-[:precedes]->(t1:time {num:19050000})-...
ordering is built into the nodes too.
This is, so far, how I have liked to do my event dating

Crystal Reports 2011 time -24 hours

I have created a report that pulls all the data from the previous day's production. The problem with that is our operations is two shifts and information from second shift is entered around 230 AM the next morning (ex. production was the 15th, but they didn't enter data until 16th at 230AM).
This is the formula that I used:
date({REJECTS.PROD_DATE})=dateadd('d',-1,currentdate).
I tried this formula with the same results: date({REJECTS.TIME_STAMP})=dateadd('h',-24,currentdatetime).
I have verified that REJECTS.TIME_STAMP is a datetime field.
Any help would be great,
Thanks
Trevor
Add this to your report's record-selection formula:
// timestamp should be new than 24 hours before the current date/time (calculated dynamically)
{REJECTS.TIME_STAMP} >= DateAdd("h", -24, CurrentDateTime)
// include other restrictions as necessary
AND ...
My approach would be:
Create a String parameter and give default values for 24 hours... in the required format (either half hour format or Hour format).
If you require check the link for parameters.
2 use below formula in Record Select Expert
{REJECTS.TIME_STAMP}>=Cdatetime(Cdate(dateadd('d',-1,currentdate)),Ctime({?tme})) and
{REJECTS.TIME_STAMP}<Cdatetime(CDate(dateadd('d',0,currentdate)),Ctime({?time})) and
Now when you run the report you will be prompted for time.. select the time and you query will be formed as required by you.

Google Spreedsheet Maths Date function

ok so in column A i have todays date 18/06/2013 and i want to add 25 days to it, but because i have a list of 100 dates (all different) I need away to do the same thing that
=DATE(2013,06,18)+25
would do but if you look in open office you can do the same thing by running =A1+25 and that gives you the date in 25 days, in Google that does not work.
The TODAY function for Google Spreedsheets returns the current computer system date. The value is updated when your document recalculates. Look at Google spreadsheets function list.
Here is an example:
=TODAY()+25

Btrieve Date Integer

this is my question:
I'm migrating data from a Btrieve file (.dat) through Pervasive Control Center and there is field type which is defined as integer but is a date and for example the date '31/12/2009' (seen in the legacy system) is view it as the number 733772 when I export it.
The legacy system shows the date correctly but I can't export it in the same format or at least I can't convert it. Does anybody know how to convert this number through Excel or something?
When I divided 733772 by 365.2425 (Number of days in year considering Leap year and 29 days of Feb - http://www.timeanddate.com/date/leapyear.html), it gave back 2009.
Go to format cells and changing category to date.