Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Separate GMT date into date and military time

    I have a data set with the date as shown in the sample data. I wish to separate the variable "date_GMT" into two variables of date and time. Time should be in 24-hour military time format in the Central European Time zone. How can I do this in Stata?. Many thanks for your time in advance.

    date_unix date_GMT

    1633039440 Sep 30 2021 - 10:04pm
    1633039440 Sep 30 2021 - 10:04pm
    1633039440 Sep 30 2021 - 10:04pm
    1633039920 Sep 30 2021 - 10:12pm
    1633039920 Sep 30 2021 - 10:12pm
    1633040086 Sep 30 2021 - 10:14pm
    1633040100 Sep 30 2021 - 10:15pm
    1633040160 Sep 30 2021 - 10:16pm
    1633040160 Sep 30 2021 - 10:16pm

  • #2
    See

    Code:
    help dofc()
    help clock
    To move from GMT to CET, you add 2 hours. The rest is just a display issue. Compare

    Code:
    di %tchh:MM 229000000
    di %tcHH:MM 229000000
    and by extension

    Code:
    di %tcHHMM 229000000
    Res.:

    Code:
    . di %tchh:MM 229000000
     3:36
    
    . di %tcHH:MM 229000000
    15:36
    
    
    . di %tcHHMM 229000000
    1536
    Last edited by Andrew Musau; 01 Oct 2021, 09:52.

    Comment

    Working...
    X