vba:如何将欧洲日期格式dd / mm / yyyy转换为文本格式dd-mm-yyyy [英] vba : how to convert european date format dd/mm/yyyy to text format dd-mm-yyyy

查看:229
本文介绍了vba:如何将欧洲日期格式dd / mm / yyyy转换为文本格式dd-mm-yyyy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VBA中正确转换日期时遇到问题。
当我使用此功能格式(日期,"dd-MM-yyyy")时,当日期为>时结果正常。 12。如果那天<= 12,那么转换是错误的=>天变成月,反之亦然2006年3月4日的转换日期为2006年4月3日,而不是04-03-2006,2006年3月20日的转换将正确转换为20-03-2006
br />如何解决这个问题?非常感谢!!!

解决方案

你好orangefuture。请注意,此论坛适用于VB.NET。这个论坛顶部有一个粘性帖子,其中包含VBA问题的链接...

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/c147bae1-c9db-4ae8-9557-43713004cc94


I have a problem to convert dates correctly in VBA.
When I use this function Format(date, "dd-MM-yyyy")  the result is ok when the day is > 12 . if the day <= 12 then the conversion is wrong => days become months and vice versa

f.e. the conversion of the date 4 March 2006 will be 03/04/2006 in stead of 04-03-2006
the conversione of the date 20 March 2006 will be correctly converted to 20-03-2006

How to solve this ? thanks a lot !!!

解决方案

Hi orangefuture.  Please note that this forum is for VB.NET.  There is a sticky thread at the top of this forum that has links for VBA questions...

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/c147bae1-c9db-4ae8-9557-43713004cc94


这篇关于vba:如何将欧洲日期格式dd / mm / yyyy转换为文本格式dd-mm-yyyy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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