Formatting hours and minutes

A discussion of how to use EasyPatterns, EasyPattern Helper and using the EasyPattern library.

Moderator: DataMystic Support

jaymiller
Posts: 2
Joined: Thu Feb 11, 2010 8:45 am
Location: Frederick, Maryland USA

Formatting hours and minutes

Postby jaymiller » Thu Feb 11, 2010 3:24 pm

I'm on the EasyPattern learning curve, trying to mill a collection of weather data files into a single file for import to Access. All is going well except for a formatting problem that I'm not having much luck in solving.

The data are in CSV files, and each line starts with the measurement time and date information:
2009 , 2 , 1 , 12 , 8 ,
with the measurements following after. Here the order is Year, Month, Day, Hour, Minute.

In the output file I need the date and time to be re-formatted thus:
2-1-09 12:08


Here's the problem: how can I get the leading zero that I need in the case of single digit minute data? At the moment my filter outputs
12:8
, not
12:08


Any help will be greatly appreciated.

Regards,

JM

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Formatting hours and minutes

Postby DataMystic Support » Fri Feb 12, 2010 8:23 am

Hi Jay,

You need to use an extra search/replace to scan for:

Code: Select all

:(\d)[^\d]


ie colon, digit, not a digit, and if found, insert the leading zero e.g.

Code: Select all

:0$1$
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

jaymiller
Posts: 2
Joined: Thu Feb 11, 2010 8:45 am
Location: Frederick, Maryland USA

Re: Formatting hours and minutes

Postby jaymiller » Fri Feb 12, 2010 9:31 am

That works like a charm! Many thanks Simon.


Return to “EasyPatterns Support”

Who is online

Users browsing this forum: No registered users and 1 guest