How to convert a Textbox.Text holding Date binary into datetime format RRS feed

  • Question

  • User-775831949 posted

    I have on aspx page a textbox displaying a text


    It is generated from a binary dateTime.Now taking away a "-" in front.

    I need to convert this back to format like 11/17/2017 8:53pm something like this and display in Label1.Text

    What is the code ? I tried many ways still cannot do it

    Pls help Thanks

    Friday, November 17, 2017 9:18 AM


  • User-1629691846 posted

    If you do not want to make it human understandable, then use uniqueidentifier for your file name. It will be generated unique each time you generate it. Here is the code sample :

    string filename = Guid.NewGuid().ToString();

    For your datetime value, you can generate it like :


    But it is unique for a each second. You might get duplicate if two user access your app at same time (including seconds).

    I still prefer first approach.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 17, 2017 9:52 AM