my friend given me a task in golang but i am unable to do it. anyone will help?
i have PHP Codes, but i want to write it in GoLang.
The Task is to get current DateTime and then convert it to base64 and then convert that base64 output to JSON.
For Encoding ito JSON, we have some special characters also.
My Friend given me codes to decode that into PHP, but my task is to understand how to decode and then try to encoding the same in GOLang by understanding decoding. I Hope you guys understood -_-
Here are codes to decode :-
$lol = "G7C5w3hJ9nR+uI0i/AwO/nuH1Iw+Eu"; $lol = trim($lol); $default = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; $custom = "BSeI0grQ9Cmt/1oduh8AsF23wvZjpfGENx+n5JPMRYLDWqlVXy7zTHicO4UkKba6"; $lolc = base64_decode(strtr($lol, $custom, $default)); $lol = json_decode($lolc, true); $date=date_create($lol['date']);
these are in PHP but easy to understand. $ means variable.
first, $lol is a base64 and json encoded string, we convert it to date.
now we have to get current date and then need to convert it to base64 using custom character as given in PHP code then we have to encode that base64 string to json
please anyone tell how to do that