Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d6d75a03

Přidáno uživatelem Petr Hlaváč před asi 4 roky(ů)

Date format reworked for new datepicker

Zobrazit rozdíly:

modules/crawler/Utilities/DateFormating.py
5 5
        string_date: string containing date in format 22.08.2018 12:27:00
6 6

  
7 7
    Returns:
8
        string of date in format 0804201814 ddmmYYYY
8
        string of date in format YYYY-mm-dd-hh
9 9
    """
10 10
    if string_date[11].isspace():
11 11
        pos = 0
......
21 21

  
22 22
        string_date = srr
23 23

  
24
    return_date = string_date[:2] + string_date[3:5] + string_date[6:10]
24
    return_date = string_date[6:10] + '-' + string_date[3:5] + '-' + string_date[:2]
25 25

  
26 26
    return return_date
27 27

  
28 28

  
29 29
def date_time_formatter(string_date):
30 30
    """
31
    Converts one type of date format "dd.mm.yyyy hh.mm.ss" to date format ddmmYYYYhh
31
    Converts one type of date format "dd.mm.yyyy hh.mm.ss" to date format YYYY-mm-dd-hh
32 32
    Args:
33 33
        string_date: string containing date in format 22.08.2018 12:27:00
34 34

  
35 35
    Returns:
36
        string of date in format 0804201814 ddmmYYYYhh
36
        string of date in format YYYY-mm-dd-hh
37 37
    """
38 38
    if string_date[11].isspace():
39 39
        pos = 0
......
49 49

  
50 50
        string_date = srr
51 51

  
52
    return_date = string_date[:2] + string_date[3:5] + string_date[6:10] + string_date[11:13]
52
    return_date = string_date[6:10] + '-' + string_date[3:5] + '-' + string_date[:2] + '-' + string_date[11:13]
53 53

  
54 54
    return return_date

Také k dispozici: Unified diff