locked
Extracting Date Time RRS feed

  • Question

  • User954998566 posted

    Hi, 

    I have a date value of a field = "8/1/2016 1:00:00 PM -06:00

    How can I extract the Date Time (using vb.net) as 8/1/2016 13:00:00 in order to load in database  (no need for offset)

    Thanks

    Friday, August 19, 2016 6:46 PM

Answers

  • User-2057865890 posted

    Hi salim,

    C#

    var str = "8/1/2016 1:00:00 PM -06:00";
    var d = DateTimeOffset.Parse(str).ToString("MM/dd/yyyy HH:mm:ss");

    VB

    Dim str = "8/1/2016 1:00:00 PM -06:00"
    Dim d = DateTimeOffset.Parse(str).ToString("MM/dd/yyyy HH:mm:ss")

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 20, 2016 5:09 PM

All replies

  • User-1672470423 posted

    Check below link:

    http://stackoverflow.com/questions/22200627/convert-datetimeoffset-to-military-time-vb-net

    Friday, August 19, 2016 8:22 PM
  • User-2057865890 posted

    Hi salim,

    C#

    var str = "8/1/2016 1:00:00 PM -06:00";
    var d = DateTimeOffset.Parse(str).ToString("MM/dd/yyyy HH:mm:ss");

    VB

    Dim str = "8/1/2016 1:00:00 PM -06:00"
    Dim d = DateTimeOffset.Parse(str).ToString("MM/dd/yyyy HH:mm:ss")

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 20, 2016 5:09 PM