转换为太阳,格里高利历部分工作,但一年不到三天 [英] Converting to solar ,Gregorian calendar working partially !, but not in three days a year
问题描述
大家好
转换为太阳能 日历下面的代码可能(部分原因!,因为微软尚未完全开发)
Converting to solar calendar with below code posible (partially ! ,because not yet microsoft developed compleltly)
,但不是一年三天05.18.2016& 2016年5月19日& 2016.05.20
but not in three days a year 05.18.2016 & 05.19.2016 & 05.20.2016
暗淡
dt DateTime =
dt AsDateTime= "05.18.2016"
()
Dimjc As New PersianCalendar()
日期
Dim Fdate As New DateTime
Fdate =
Fdate =
(jc.GetYear(dt), jc.GetMonth(dt),jc.GetDayOfMonth(dt),dt.Hour,dt.Minute,dt.Second, DateTimeKind .Local)
New DateTime(jc.GetYear(dt), jc.GetMonth(dt), jc.GetDayOfMonth(dt), dt.Hour, dt.Minute, dt.Second, DateTimeKind.Local)
例如
Catch Ex AsException
,
MessageBox.Show(Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
尝试
我认为错误检查仅适用于公历月,例如应该重新设计为太阳月.
i think error checking only working with Gregorian month day and should be redesign solar month day for example
dt =
"05.17.2016"'==> "#2/28/1395"
波斯语,第二个月为31天,英语, 第二个月有28天
in persian ,second month have 31 days and in english, second month have 28 days
最好的回忆
yarmini
yarmini
推荐答案
我不知道您在做什么.
I don't know what you think you are doing.
但是,完全不需要尝试捕获.
However, a try and catch should completely not needed.
此代码最终在第二个月和第二十八天给出了1395年
This Code gives as result the year 1395 in the 2nd month and the 28th day
Imports System.Globalization
Module Module1
Public Sub Main()
Dim dt As New DateTime(2016, 5, 17)
Dim jc As New PersianCalendar()
Console.WriteLine(jc.GetYear(dt) & " " & jc.GetMonth(dt) & " " & jc.GetDayOfMonth(dt))
Console.ReadLine()
End Sub
End Module
这篇关于转换为太阳,格里高利历部分工作,但一年不到三天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!