I seek to geospatially merge some rainfall data with a master dataset. Before I can do that though, I must have the date of the weather be formatted properly. Here's some of my data so you can follow me.
Here, time series data come in the form of "16aug2020 00:00:00". I only need the "12aug2020" part. I've worked with converting string dates to something Stata recognizes... But I've never needed (or thought I'd need!) to convert a date with seconds, minutes and hours to just the day, month and year. My first instinct was that it was a formatting issue, so I did
but this returns an ungodly long number in scientific notation (presumably, the number of seconds since January 1 1960).What might I be missing here?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long index double(date _CY _CX) float rain 711 1.9131552e+12 49.400000000000006 -95.14166663333334 0 712 1.9131552e+12 49.400000000000006 -95.09999996666667 0 713 1.9131552e+12 49.400000000000006 -95.05833330000002 0 714 1.9131552e+12 49.400000000000006 -95.01666663333334 0 715 1.9131552e+12 49.400000000000006 -94.97499996666667 0 716 1.9131552e+12 49.400000000000006 -94.93333330000002 0 717 1.9131552e+12 49.400000000000006 -94.89166663333334 0 718 1.9131552e+12 49.400000000000006 -94.84999996666667 0 2096 1.9131552e+12 49.358333333333334 -95.18333330000002 0 2097 1.9131552e+12 49.358333333333334 -95.14166663333334 0 2098 1.9131552e+12 49.358333333333334 -95.09999996666667 0 2099 1.9131552e+12 49.358333333333334 -95.05833330000002 0 2100 1.9131552e+12 49.358333333333334 -95.01666663333334 0 2101 1.9131552e+12 49.358333333333334 -94.97499996666667 0 2102 1.9131552e+12 49.358333333333334 -94.93333330000002 0 2103 1.9131552e+12 49.358333333333334 -94.89166663333334 0 2104 1.9131552e+12 49.358333333333334 -94.84999996666667 0 2105 1.9131552e+12 49.358333333333334 -94.80833330000002 0 3482 1.9131552e+12 49.31666666666667 -95.18333330000002 0 3483 1.9131552e+12 49.31666666666667 -95.14166663333334 0 3484 1.9131552e+12 49.31666666666667 -95.09999996666667 0 3485 1.9131552e+12 49.31666666666667 -95.05833330000002 0 3486 1.9131552e+12 49.31666666666667 -95.01666663333334 0 3487 1.9131552e+12 49.31666666666667 -94.97499996666667 0 3488 1.9131552e+12 49.31666666666667 -94.93333330000002 0 3489 1.9131552e+12 49.31666666666667 -94.89166663333334 0 3490 1.9131552e+12 49.31666666666667 -94.84999996666667 0 3491 1.9131552e+12 49.31666666666667 -94.80833330000002 0 3492 1.9131552e+12 49.31666666666667 -94.76666663333334 0 4868 1.9131552e+12 49.275000000000006 -95.18333330000002 0 4869 1.9131552e+12 49.275000000000006 -95.14166663333334 0 4870 1.9131552e+12 49.275000000000006 -95.09999996666667 0 4871 1.9131552e+12 49.275000000000006 -95.05833330000002 0 4872 1.9131552e+12 49.275000000000006 -95.01666663333334 0 4873 1.9131552e+12 49.275000000000006 -94.97499996666667 0 4874 1.9131552e+12 49.275000000000006 -94.93333330000002 0 4875 1.9131552e+12 49.275000000000006 -94.89166663333334 0 4876 1.9131552e+12 49.275000000000006 -94.84999996666667 0 4877 1.9131552e+12 49.275000000000006 -94.80833330000002 0 4878 1.9131552e+12 49.275000000000006 -94.76666663333334 0 6254 1.9131552e+12 49.233333333333334 -95.18333330000002 0 6255 1.9131552e+12 49.233333333333334 -95.14166663333334 0 6256 1.9131552e+12 49.233333333333334 -95.09999996666667 0 6257 1.9131552e+12 49.233333333333334 -95.05833330000002 0 6258 1.9131552e+12 49.233333333333334 -95.01666663333334 0 6259 1.9131552e+12 49.233333333333334 -94.97499996666667 0 6260 1.9131552e+12 49.233333333333334 -94.93333330000002 0 6261 1.9131552e+12 49.233333333333334 -94.89166663333334 0 6262 1.9131552e+12 49.233333333333334 -94.84999996666667 0 6263 1.9131552e+12 49.233333333333334 -94.80833330000002 0 6264 1.9131552e+12 49.233333333333334 -94.76666663333334 0 7640 1.9131552e+12 49.19166666666667 -95.18333330000002 0 7641 1.9131552e+12 49.19166666666667 -95.14166663333334 0 7642 1.9131552e+12 49.19166666666667 -95.09999996666667 0 7643 1.9131552e+12 49.19166666666667 -95.05833330000002 0 7644 1.9131552e+12 49.19166666666667 -95.01666663333334 0 7645 1.9131552e+12 49.19166666666667 -94.97499996666667 0 7646 1.9131552e+12 49.19166666666667 -94.93333330000002 0 7647 1.9131552e+12 49.19166666666667 -94.89166663333334 0 7648 1.9131552e+12 49.19166666666667 -94.84999996666667 0 7649 1.9131552e+12 49.19166666666667 -94.80833330000002 0 7650 1.9131552e+12 49.19166666666667 -94.76666663333334 0 7651 1.9131552e+12 49.19166666666667 -94.72499996666667 0 9026 1.9131552e+12 49.150000000000006 -95.18333330000002 0 9027 1.9131552e+12 49.150000000000006 -95.14166663333334 0 9028 1.9131552e+12 49.150000000000006 -95.09999996666667 0 9029 1.9131552e+12 49.150000000000006 -95.05833330000002 0 9030 1.9131552e+12 49.150000000000006 -95.01666663333334 0 9031 1.9131552e+12 49.150000000000006 -94.97499996666667 0 9032 1.9131552e+12 49.150000000000006 -94.93333330000002 0 9033 1.9131552e+12 49.150000000000006 -94.89166663333334 0 9034 1.9131552e+12 49.150000000000006 -94.84999996666667 0 9035 1.9131552e+12 49.150000000000006 -94.80833330000002 0 9036 1.9131552e+12 49.150000000000006 -94.76666663333334 0 9037 1.9131552e+12 49.150000000000006 -94.72499996666667 0 10412 1.9131552e+12 49.108333333333334 -95.18333330000002 0 10413 1.9131552e+12 49.108333333333334 -95.14166663333334 0 10414 1.9131552e+12 49.108333333333334 -95.09999996666667 0 10415 1.9131552e+12 49.108333333333334 -95.05833330000002 0 10416 1.9131552e+12 49.108333333333334 -95.01666663333334 0 10417 1.9131552e+12 49.108333333333334 -94.97499996666667 0 10418 1.9131552e+12 49.108333333333334 -94.93333330000002 0 10419 1.9131552e+12 49.108333333333334 -94.89166663333334 0 10420 1.9131552e+12 49.108333333333334 -94.84999996666667 0 10421 1.9131552e+12 49.108333333333334 -94.80833330000002 0 10422 1.9131552e+12 49.108333333333334 -94.76666663333334 0 10423 1.9131552e+12 49.108333333333334 -94.72499996666667 0 11137 1.9131552e+12 49.06666666666667 -122.72499996666667 0 11138 1.9131552e+12 49.06666666666667 -122.68333330000002 0 11139 1.9131552e+12 49.06666666666667 -122.64166663333334 0 11140 1.9131552e+12 49.06666666666667 -122.59999996666667 0 11141 1.9131552e+12 49.06666666666667 -122.55833330000002 0 11142 1.9131552e+12 49.06666666666667 -122.51666663333334 0 11143 1.9131552e+12 49.06666666666667 -122.47499996666667 0 11144 1.9131552e+12 49.06666666666667 -122.43333330000002 0 11145 1.9131552e+12 49.06666666666667 -122.39166663333334 0 11146 1.9131552e+12 49.06666666666667 -122.34999996666667 0 11147 1.9131552e+12 49.06666666666667 -122.30833330000002 0 11148 1.9131552e+12 49.06666666666667 -122.26666663333334 0 11149 1.9131552e+12 49.06666666666667 -122.22499996666667 0 end format %tc date br
Code:
format %td date

Comment