使用System.Globalization将波斯日期转换为格里高利日期和格里高利日期转换为波斯日期 [英] Converting Persian Date to Gregorian Date and Gregorian to Persian Date using System.Globalization

查看:86
本文介绍了使用System.Globalization将波斯日期转换为格里高利日期和格里高利日期转换为波斯日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个项目,在该项目中,用户可以为其交易选择格里高利和波斯日期。在数据库中我有两个字段TPersianDate和TGregorianDate,如果用户在插入按钮上选择波斯日期我想将同一日期
转换为格里高利并将其插入TGregorianDate,反之亦然。

I am working on a project where user have Gregorian and Persian Date selection for the their transactions. In database i have two fields TPersianDate and TGregorianDate, if a user select Persian date on the insert button i want to convert the same date to Gregorian and insert it in TGregorianDate and vice versa.

推荐答案

在MSDN中查看
PersianCalendar
。它演示了在格里高利和波斯日历中显示日期。这就是你需要的代码。
Take a look at the example in MSDN for PersianCalendar. It demonstrates showing a date in both Gregorian and Persian calendars. That is the code you'll need.


这篇关于使用System.Globalization将波斯日期转换为格里高利日期和格里高利日期转换为波斯日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆