locked
datetime convertion RRS feed

  • Question

  • User-353733005 posted

    I want to convert my date yyyy-mm-dd to yyyymmdd and time hh:mm:ss to hhmmss and both concatenate like yyymmddThhmmss. Can any one please help me. If you given your example using a function then it would be very helpful for me. Thanks in advance.

    Thursday, September 4, 2014 8:09 AM

Answers

  • User-1360095595 posted

    Simple, as long as you have a DateTime object. You can use: date.ToString("yyyyMMddhhmmss"). Here "date" is a DateTime object...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 4, 2014 8:17 AM
  • User842257015 posted

    Hi Shibly,

    use ToString() for that,

     dateVariable.ToString("yyyyMMddHHmmss");

    yyyy - full Year => 2014

    yy - current year => 14

    MM  - month 

    dd - date

    HH - hour

    mm - minutes

    ss - seconds

    please make sure MM and mm are completely different.

    i hope it could help you.

    Kind,

    Jai

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 4, 2014 11:30 AM

All replies

  • User-1360095595 posted

    Simple, as long as you have a DateTime object. You can use: date.ToString("yyyyMMddhhmmss"). Here "date" is a DateTime object...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 4, 2014 8:17 AM
  • User-760709272 posted

    Do you actually have DateTime objects or do you only have strings with things like "2014-09-04" in them?

    Thursday, September 4, 2014 8:20 AM
  • User842257015 posted

    Hi Shibly,

    use ToString() for that,

     dateVariable.ToString("yyyyMMddHHmmss");

    yyyy - full Year => 2014

    yy - current year => 14

    MM  - month 

    dd - date

    HH - hour

    mm - minutes

    ss - seconds

    please make sure MM and mm are completely different.

    i hope it could help you.

    Kind,

    Jai

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 4, 2014 11:30 AM