PowerShell中iso8601格式日期和DateTime对象互转实例

参考链接:
https://technet.microsoft.com/zh-cn/library/aa997624(v=exchg.150).aspx
https://www.pstips.net/convert-iso8601-date-string-to-date-object.html
https://www.pstips.net/convert-datetime-to-iso8601-format.html
https://segmentfault.com/a/1190000004292140
https://edu.aliyun.com/a/9853?spm=5176.11310711.0.0.YrSQfd

Powershell将日期时间转换成iso8601格式
#$now=Get-Date
#$now.ToString(‘yyyy-MM-ddTHH:mm:ss.fffZ‘)

Powershell将iso8601格式的日期字符串转换成DateTime对象
#$dateTimeStr = ‘2018-07-10T13:49:38.532Z‘
#$format = ‘yyyy-MM-ddTHH:mm:ss.fffZ‘
#$formatProvider = [Globalization.CultureInfo]::InvariantCulture
#[datetime]::ParseExact($dateTimeStr,$format,$formatProvider)

注:执行的时候请删除#

原文地址:http://blog.51cto.com/yuntcloud/2140673

时间: 2024-08-27 00:54:01

PowerShell中iso8601格式日期和DateTime对象互转实例的相关文章

javascript中字符串格式转化成json对象记录

什么是JSON JSON(JavaScript Object Notation)是一种优美的JavaScript对象创建方法.JSON也是一种轻量级数据交换格式.JSON非常易于人阅读与编写,同时利于机器解析与生成.JSON是在AJAX中代替XML交换数据的更佳方案. JSON格式与语法 var jsonobject= {         //对象内的属性语法(属性名与属性值是成对出现的)         propertyname:value, //对象内的函数语法(函数名与函数内容是成对出现的

fastJson中常用JSON字符串和Java对象互转

1.使用fastJson,首先引入fastJson依赖 <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.54</version> </depen

Python日期操作datetime

datetime模块定义了下面这几个类: datetime.date:表示日期的类.常用的属性有year, month, day.datetime.time:表示时间的类.常用的属性有hour, minute, second, microsecond.datetime.datetime:表示日期时间.datetime.timedelta:表示时间间隔,即两个时间点之间的长度.datetime.tzinfo:与时区有关的相关信息 注 :上面这些类型的对象都是不可变(immutable)的. 下面详

C#中 String 格式的日期时间 转为 DateTime

C#中并没有表示时间的变量,只有DateTime,所以要表示时间,可以用TimeSpan表示. 方法一:Convert.ToDateTime(string) string格式有要求,必须是yyyy-MM-dd hh:mm:ss 方法二:Convert.ToDateTime(string, IFormatProvider) DateTime dt; DateTimeFormatInfo dtFormat = new System.GlobalizationDateTimeFormatInfo();

Json 的日期格式转换成DateTime

JSON 的日期形式:"/Date(1242357713797+0800)/" , 下面我们就用以下C#的方法将他转换成DateTime类型: /// <summary> /// Json 的日期格式与.Net DateTime类型的转换/// </summary> /// <param name="jsonDate">Json 的日期,例如:/Date(928120800000+0800)/</param> ///

powershell中使用超大内存对象

简单介绍了powershell中超大内存对象的用途,开启powershell超大内存对象的办法. powershell 传教士 原创文章 2016-12-31 允许转载,但必须保留名字和出处,否则追究法律责任 powershell 2GB large object .net 大对象 前 言 问:powershell中,哪些对象有可能会占用大内存? 答: stringbuilder对象,大数组arraylist,hashset等. 问:powershell中,stringbuildr对象有什么用?

spring mvc3中JACKSON序列化日期格式的问题 - 墙头草的Java - BlogJava

body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI",Tahoma,Helvetica,Sans-Serif,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif; font-size: 10.5pt; line-height: 1.5;

jquery 解析数据库中的json日期为正常的格式

//在action从后台数据库中请求获得日期以后,得到的是json格式的数据,因此要解析才能显示在前台1.在jsp页面写的代码如下:<html> <script> Date.prototype.format = function(format) { var o = { "M+": this.getMonth() + 1, // month "d+": this.getDate(), // day "h+": this.ge

常用SQL时间格式SQLServer中文版的默认的日期字段datetime格式是yyyy-mm-d

常用SQL时间格式 SQL Server中文版的默认的日期字段datetime格式是yyyy-mm-dd Thh:mm:ss.mmm 例如: select getdate() 2004-09-12 11:06:08.177 这对于在要不同数据库间转移数据或者习惯oracle日期格式YYYY-MM-DD HH24:MI:SS的人多少有些不方便. 我整理了一下SQL Server里面可能经常会用到的日期格式转换方法: 举例如下: select CONVERT(varchar, getdate(),