如何在一个字符中分割日期? [英] how to split date in a single character?

查看:88
本文介绍了如何在一个字符中分割日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目日期格式是18 02 2015,但是用户需要1 8 0 2 2 0 1 5这样,我怎么能这样做,任何人都可以帮助我,



先谢谢。

In my project date format is 18 02 2015 , but user needs 1 8 0 2 2 0 1 5 like this ,how can i do it , can any one please help me,

Thanks in advance.

推荐答案

我不认为这是一种日期格式。你必须把这个输出作为一个字符串发送。

将你的日期转换为字符串,操纵它并创建另一个字符串,每个整数之间都有空格。
I don't think this is a date format. You have to send this output as a string.
Convert your date into string, manipulate it and create another string with spaces in between every integer.


既然你已标记此SQL Server,我认为您将日期以字符串格式存储在数据库中。如果是这种情况,请不要这样做。在数据库中使用 date 数据类型并处理调用端的所有格式。数据库通常不应该用于格式化数据。



如何将日期格式化为所需格式,使用您拥有的语言或工具客户端。
Since you have tagged this SQL Server, I take it that you're storing the dates in string format in the database. If that is the case, don't do that. Use date data type in the database and handle all the formatting on the calling side. The database shouldn't typically be used to format the data at all.

What comes to formatting the date into the required format, use the language or tools you have on the client side.


这篇关于如何在一个字符中分割日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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