I want to convert any date time (not current) format into unix timestamp. $dateToConvert = "2018-12-11 01:00:00"
input: $dateToConvert output: 1544490000 (value that i got from converter)
will be really thankful for help!
You would need to convert the $dateToConvert to a [DateTime] object before messing with it in PowerShell. You can then change the format of it to seconds by using the -UFormat parameter.
[datetime]$dateToConvert = "2018-12-11 01:00:00"
Get-Date -Date $dateToConvert -UFormat %s
More information regarding changing the format of the Get-Date can be found on the MSDocs Site
EDIT:
As per comment, you can just do the below for the same result.
Get-Date -Date "2018-12-11 01:00:00" -UFormat %s
-UFormat hint, but note that you can pass the date/time string directly to Get-Date, which implicitly converts it to [datetime] (using the rules of the invariant culture, as with the cast).