Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# DateTime.parseMJD

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)
```Parse 16 bit unsigned int containing Modified Julian Date, as per DVB-SI spec
returning year,month,day
```

```        def parseMJD(MJD):
"""Parse 16 bit unsigned int containing Modified Julian Date, as per DVB-SI spec
returning year,month,day"""
YY = int( (MJD - 15078.2) / 365.25 )
MM = int( (MJD - 14956.1 - int(YY*365.25) ) / 30.6001 )
D  = MJD - 14956 - int(YY*365.25) - int(MM * 30.6001)

K=0
if MM == 14 or MM == 15:
K=1

return (1900 + YY+K), (MM-1-K*12), D
```

```    dvb3f = Descriptive()

from DateTime import unBCD, parseMJD

def parseDescriptor(i,data,parser_sets=None):
```
```
offset     = ( unBCD(e[1]), unBCD(e[2]) )
changeDateTime = list( parseMJD((e[3]<<8) + e[4]) )
changeDateTime.extend( [unBCD(e[5]), unBCD(e[6]), unBCD(e[7])] )
nextOffset = ( unBCD(e[8]), unBCD(e[9]) )
```

```    dvb3f = Descriptive()

from DateTime import unBCD, parseMJD

def parseDescriptor(i,data,parser_sets=None):
```
```
offset     = ( unBCD(e[1]), unBCD(e[2]) )
changeDateTime = list( parseMJD((e[3]<<8) + e[4]) )
changeDateTime.extend( [unBCD(e[5]), unBCD(e[6]), unBCD(e[7])] )
nextOffset = ( unBCD(e[8]), unBCD(e[9]) )
```

```    dvb3f = Descriptive()

from DateTime import unBCD, parseMJD

def parseDescriptor(i,data,parser_sets=None):
```
```
offset     = ( unBCD(e[1]), unBCD(e[2]) )
changeDateTime = list( parseMJD((e[3]<<8) + e[4]) )
changeDateTime.extend( [unBCD(e[5]), unBCD(e[6]), unBCD(e[7])] )
nextOffset = ( unBCD(e[8]), unBCD(e[9]) )
```