2.1.3 • Published 8 years ago

bcd-date v2.1.3

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

bcd-date

Build Status

Node.js package to decode BCD datetime buffers used by Siemens and Rockwell PLCs into a normal javascript date objects.

The format of the BCD date is as follows

ByteContentsRange
0Year90-89
1Month1-12
2Day1-31
3Hour0-23
4Minute0-59
5Second0-59
62 MSD of ms0-99
7 (1st nibble)LSD of ms0-9
7 (2nd nibble)Day of week (unused)1-7

example

var bcdDate = require('bcd-date');

var buffer = new Buffer('1012231130301235', 'hex');

var date   = bcdDate.decode(buffer);
var buffer = bcdDate.encode(date);

// date   == date at 2010-12-23 11:30:30.123
// buffer == buffer of 1012231130301235

// decode as UTC
var date = bcdDate.decode(buffer, true);

// encode as UTC
var date = bcdDate.encode(buffer, true);
2.1.3

8 years ago

2.1.2

8 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago