MCPcopy Index your code
hub / github.com/ccxt/ccxt / parseDate

Method parseDate

java/lib/src/main/java/io/github/ccxt/base/Time.java:77–100  ·  view source on GitHub ↗
(Object datetime2)

Source from the content-addressed store, hash-verified

75
76 // Returns Long (epoch millis) or null
77 public static Object parseDate(Object datetime2) {
78 if (!(datetime2 instanceof String)) {
79 return null;
80 }
81
82 String datetime = stripUtcSuffix(((String) datetime2).trim());
83 if (datetime.isEmpty()) {
84 return null;
85 }
86
87 try {
88 // ISO 8601 like: 1986-04-26T01:23:47.000Z
89 if (datetime.indexOf('T') >= 0) {
90 return Instant.parse(datetime).toEpochMilli();
91 }
92
93 // Space format like: 1986-04-26 00:00:00 (treated as UTC)
94 LocalDateTime ldt = LocalDateTime.parse(datetime, SPACE_FORMAT);
95 return ldt.toInstant(ZoneOffset.UTC).toEpochMilli();
96
97 } catch (DateTimeParseException ex) {
98 return null;
99 }
100 }
101
102 // public static Long parse8601(Object datetime2) {
103 // if (!(datetime2 instanceof String)) return null;

Callers 15

parseDateMethod · 0.95
parseTickerMethod · 0.45
parseTradeMethod · 0.45
parseOrderMethod · 0.45
parseTransactionMethod · 0.45
parseTransferMethod · 0.45
parseTickerMethod · 0.45
parseTradeMethod · 0.45
parseOrderMethod · 0.45
parseTransactionMethod · 0.45
parseTransferMethod · 0.45
parseTransferMethod · 0.45

Calls 3

stripUtcSuffixMethod · 0.95
isEmptyMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected