Convert Hijri Shamsi date format tsql -


i want convert hijri shamsi date '92/2/3' format : '92/02/03'

with code, error :the conversion of varchar data type datetime data type resulted in out-of-range value.

declare @str varchar(10) = '92/2/3' select convert(varchar(10), convert(datetime, @str), 111) 

how can change format of date ?

  1. since don't have centuries should use 11, not 111 conversion code
  2. you need use 11 in inner convert tell format converting from

    declare @str varchar(10) = '92/2/3'     select convert(varchar(10), convert(datetime, @str,11), 11) 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -