Results 1 to 3 of 3

Thread: DateTime conversion to Date

  1. #1

    Default DateTime conversion to Date

    I have a field in my dataset that is currently formatted as a datetime (e.g. 2014-11-30 12:01:16)

    I want to convert this field to be a date (e.g. 2014-11-30 or D/M/CCYY)

    I have tried to convert using lots of different syntax but none works. There must be a simple solution that is eluding me..... please help before I lose the plot!

    Thanks

    Andy

  2. #2
    Lavastorm Employee stonysmith's Avatar
    Join Date
    Nov 2006
    Location
    Grapevine Tx
    Posts
    799

    Default

    If the field is already a datetime data type, you can simply use date(myfield) to remove the time.
    However, if the field is a string, then you can use date(left(myfield,10),"CCYY-MM-DD")

  3. #3

    Default

    I knew it would be simple - I was trying to convert to a string or unicode and then use left or substr - I was over complicating it.

    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •